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 03-28-2007
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,809
You don't need cat.


Code:
awk -F: '{
  FILENAME=="in_file" {in_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4}
  FILENAME=="out_file" {out_total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4 }
  END { printf("%f\n", in_total - out_total) }
}' in_file out_file


Last edited by vgersh99; 03-28-2007 at 02:38 PM.. Reason: vB Code tags