Calculate processing time

I have a log file which has a lot of output but I am interested in the following

Processed records: 34749; Processed files: 67445
Job run run at Thu May 6 03:00:01 PDT 2010
Job finished at Thu May 6 12:22:14 PDT 2010

So I would like to have the output as
Total time Records Files
9:22 34749 67445

One way to do it with Perl:

$ 
$ 
$ cat f8
Processed records: 34749; Processed files: 67445
Job run run at Thu May 6 03:00:01 PDT 2010
Job finished at Thu May 6 12:22:14 PDT 2010
$ 
$ 
$ 
$ perl -M"Date::Calc qw(:all)" -lne 'chomp;
  if (/^Processed records: (\d+); Processed files: (\d+)$/) {$rec=$1; $files=$2}
  elsif (/^Job run run at (.*) ([\d:]+) (.*)$/) {@d1=Parse_Date("$1 $3"); @hms1=split(/:/,$2)}
  elsif (/^Job finished at (.*) ([\d:]+) (.*)$/) {@d2=Parse_Date("$1 $3"); @hms2=split(/:/,$2)}
  END {@dhms = Delta_DHMS(@d1, @hms1, @d2, @hms2);
       printf("%-20s %-10s %-10s\n", "Total time", "Records", "Files");
       printf("%-20s %-10s %-10s\n", "$dhms[1]:$dhms[2]", $rec, $files);
  }' f8
Total time           Records    Files     
9:22                 34749      67445     
$ 
$ 

tyler_durden

Awesome..thanks