Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 22nd, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Shell Script needed - I have to collect time stamps from appserver logs
  2. perl -MTime::Local -ne '
  3.     ($ts, $y, $m, $d, $H, $M, $S, $frac) =
  4.         /((d{4})-(dd)-(dd) (dd):(dd):(dd).(d+))/;
  5.     $time = timelocal($S, $M, $H, $d, $m-1, $y-1900) + "0.$frac";
  6.     print $ts, ",", $time, "n";
  7. ' log.file > output.file
  8.        
  9. 2011-04-12 06:49:02.874,1302605342.874