Mark Richmond wrote:
> 
> Hi:

Hello,

> I have may huge log files where all I care about is the error at the end
> how can seek backwards to find my pattern and snip off the end.
> I'm looking for strings like. "======== Rebuilding "link" ========"  which
> only occur once when reading backwards but may times when reading forward.
> 
> <snip >


Here is one way to do it:

use Tie::File;

tie my @log, 'Tie::File', 'hugh_log_file' or die "Cannot open 'hugh_log_file': $!";

# remove all lines after ======== Rebuilding "link" ========
$#log-- while $log[$#log] !~ /======== Rebuilding "link" ========/;
# remove line containing ======== Rebuilding "link" ========
$#log--;

untie @log;

__END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to