There might be an easier way but you could do this:
open (DIFFR, "/tmp/log.diff"); while (<DIFFR>) { $line=$_; chomp($line); if ($line =~ /ERROR/) { print CSVFILE "$oldline\n"; #look below if stat. print CSVFILE "$line,"; } $oldline = $line; #sets a variable with the last line }
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce
In reply to Re: need to extract top and bottom lines...
by kutsu
in thread need to extract top and bottom lines...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |