Quote:
Originally Posted by vgersh99
I don't quot understand why you need all the coding when you can do it all in awk:
nawk -f bag.awk myFile
bag.awk:
Code:
{
for(i=1; i<=NF; i++)
sum[i] += $i
nf=NF
nr=NR
}
END {
for(i=1; i<=nf; i++)
print sum[i]/nr
}
|
Huh? I tried your script but I only get 1.5
when I have list:
1
2
1
2
The output should be:
1
2
Or on the same row 1 2
As I described above. But there should also be the possibility to tell how many columns there should be.