use File::ReadBackwards; use POSIX "strftime"; my $success; my $items; my $earliest = POSIX::strftime( "%Y-%m-%d %H:%M:%S", gmtime( time() - +30 * 60 ) ); $bw = File::ReadBackwards->new( 'log_file' ) or die "can't read 'log_file' $!" ; while ( defined( my $log_line = $bw->readline() ) ) { last if $log_line lt $earliest; $success ||= $log_line =~ /STATUS = SUCCESS/; $items ||= $log_line =~ /Found [1-9]\d* items to send/; last if $success && $items; }
I'm looking for a job.
In reply to Re: Parsing a specific section of a log file
by ysth
in thread Parsing a specific section of a log file
by vxp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |