Anyone know how can I calculate the mean of one these columns (on linux)??
sda 2.91 20.44 6.13 2.95 217.53 186.67 44.55 0.
Perl solution:
perl -lane '$total += $F[1]; END{print $total/$.}' file
-a autosplits the line into the @F array, which is indexed starting at 0
$. is the line number
If your fields are separated by commas instead of whitespace:
perl -F, -lane '$total += $F[1]; END{print $total/$.}' file
To print mean values of all columns, assign totals to array @t:
perl -lane 'for $c (0..$#F){$t[$c] += $F[$c]}; END{for $c (0..$#t){print $t[$c]/$.}}'
output:
0
0.485
14.38
1.74
0.888333333333333
77.27
49.8266666666667
39.91
1.29833333333333
434.131666666667