Print smallest integer from file using awk custom function?
asad
a.alii85 at gmail.com
Fri Jan 8 14:23:53 UTC 2016
`awk` function looks like this in a file name `fun.awk`:
{
print f()
}
function f()
{
if(NR==1){s=$0}
if($0<p)
{s=$0}
{p=$0}
{ return s}
}
The contents of `awk.write`:
1
23
32
The `awk` command is:
awk -f fun.awk awk.write
but it print x3 times. why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20160108/76442b9c/attachment.html>
More information about the ubuntu-users
mailing list