|
Thanks Jean-Pierre, now I don't get any errors. But the output is wierd.
If I have the list:
1
2
1
2
This would produce:
1 2
1 2
So the output should be 1 and 2 (1+1/2 and 2+2/2 ), like so:
1
2
But instead I get
2
2
Something is wrong with the way I'm going about this problem.
echo "$data" | awk -v i=$1 '{sum+=$i} END {print sum/NR}'
Is there something wrong with using NR here? But putting a number there doesn't seem to help. I tried with 2 instead of NR but (same list as above) but still I get:
2
2
Is there a problem with the division I'm making?
Edit: I just echoed data and the output comes in one line 1 2 1 2 so probably is has something to do with my problem.
Last edited by baghera; 08-28-2007 at 02:50 PM..
|