#!/usr/bin/perl
print "This program reads epoch seconds from stdin and converts them, ctrl-d to end/cancel\n";
while (<>) {
if ($_ =~ /(^\d\d\d\d\d\d\d\d\d\d)/){ #epoch time at start of line, remove ^ to enable global search
$epoch=$1;
chomp($epoch);
$_ =~ s/$epoch//;
print "(", scalar localtime $epoch, ") $_";
} else {
print $_;
}
}
1198878644 some really usefull log entry that you would love to know when it happened
(Fri Dec 28 13:50:44 2007) some really usefull log entry that you would love to know when it happened