The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-30-2007
ranj@chn ranj@chn is offline Forum Advisor  
Playing with Ubuntu Now!
  
 

Join Date: Oct 2005
Location: Chennai
Posts: 365
will this work?


Code:
awk -f temp.awk tempfile

where temp.awk is

Code:
{ for(i=1;i<=NF;i++) { sum[i]+=$i } }
END { for (i in sum) {printf("%f\t", sum[i]/NR) } }

Quote:
Btw, the second column should not be 6.5, but 4.33

Last edited by ranj@chn; 08-30-2007 at 11:41 AM.. Reason: add comments