Computing average and standard deviation from multiple text files

view full story

http://www.unix.com – Hello there, I found an elegant solution to computing average values from multiple text files Code: awk '{for (i=1;i<=NF;i++){if ($i!~"n/a"){a[FNR""i]+=$i}else{b[FNR""i]++}}}END{for (i=1;i<=FNR;i++){for (j=1;j<=NF;j++){printf (a[i""j]/(3-b[i""j]))((b[i""j]>0)?"~"b[i""j]" ":" ")};printf "\n"}}' file1 file2 file3 I tried to modify the code to get the standard deviations along with the averages, but without success. I have 3 files with two columns and 10 rows each. (HowTos)