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 -->
  #1 (permalink)  
Old 09-01-2008
BufferExploder BufferExploder is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 9
Awk question: Sum dates

Hi there,

I have a logfile which has the following layout:

20080812 0 20
20080812 12 10
20080812 12 10
20080812 12 10

I want to sum the "12" on the last 3 lines and save the "20" on the first line. The final output should be

20080812 36 20

I think that should me more easier with awk ? Many thanks in advice.