in reply to
grep lines from log for last 10 mints
Use Date::Parse and -n switch to construct this oneliner:
perl -MDate::Parse -e'BEGIN{$main::now=time;$main::old=(time-60*10)}'
+-nE'if(/^(\w+\s+\d+\s+\d+:\d+:\d+)/) {$t=str2time $1; $t > $old && $t
+ < $now && print}'
time is used to determine the current time as unix timestamp. Regular exression (some "word symbols", some space symbols, some numeric characters, some space symbols, then three groups of numeric characters delimeted by ":") is used to find the date from the string. Then it's parsed using
str2time to unix timestamp, then it's compared to the timestamps found earlier, and the string being read is
printed (
print without arguments prints the special variable
$_).
Sorry if my advice was wrong.