Another trick with awk to compute mean of a column.
Imagine that you have a file with many lines and you want to compute the mean of the fourth item on each line. E.g:
Using the awk tool under Linux, type:
awk '{x+=$4; next} END{print x/NR}'
0.4
awk '{x+=$4; next} END{print x/NR}'
0.4
0 comments:
Post a Comment