[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mon, 07 Aug 2006 22:56:18 +0300
Greetings. Re this:
> Date: Mon, 07 Aug 2006 15:42:23 +0200
> From: address@hidden
> Subject: wishes
> To: address@hidden
> I'm using gawk for the effective processing of table like numerical data.
> However, typically I don't use special awk script, but just call it from
> the command line.
> For that reason I only can use the very limited number of built-in
> numerical functions.
> Therefore my wish:
> Could you implement e.g. a min() and max() function. Ideally these should
> accept arbitrary
> numbers of input arguments. I.e.
> min($1, $2)
This one is easy:
function min(a, b)
if ((a+0) < (b+0))
return a + 0
return b + 0
> min($1, $3, $4, $5)
This one should be written to accept an array argument:
function min_a(data, i, result)
for (i in data)
if ((data[i] + 0) < result)
result = data[i] + 0
As Juergen pointed out, there are other options as well.
- wishes, frank . koster, 2006/08/07
- Re: wishes, Jürgen Kahrs, 2006/08/07
- Re: wishes,
Aharon Robbins <=