bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] How to define a function that can accept arbitrary number


From: david kerns
Subject: Re: [bug-gawk] How to define a function that can accept arbitrary number of arguments?
Date: Fri, 29 Apr 2016 18:29:36 -0700


On Fri, Apr 29, 2016 at 5:25 PM, Peng Yu <address@hidden> wrote:
Hi, I see that there are built-in functions in gawk that can accept
arbitrary number of arguments. How to define one with accept arbitrary
number of arguments by the users? Thanks.

       and(v1, v2 [, ...]) Return  the bitwise AND of the values
provided in the argument list.  There
                           must be at least two.

--
Regards,
Peng


nope, you'll have to loop on the list

echo 127 63 255 61 7 | awk '{r=$1;for(i=2;i<=NF;++i)r=and(r,$i);print r}'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]