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 -->
  #3 (permalink)  
Old 09-02-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361

Code:
awk '
 NR==1 { var1=$1; var3=$3; next }
 { var2 += $2 }
END { print var1" "var2" "var3 }' filename
I suspect that what you really want is more complex than this, If so, you'll probably have to describe your input file more completely.