in reply to need to extract top and bottom lines...
use strict; use warnings; my $last_line=''; open (DIFFR, "/tmp/log.diff") or die "Can't open /tmp/log.diff: $!"; while (<DIFFR>) { chomp; if (/\bERROR\b/) { print CSVFILE $last_line; print CSVFILE "$line,"; } $last_line = $_; }
|
---|