Figured it out...to add the line that contains the match string, I added an additional line to the loop. Probably not the best way, but it works.
while (<$_>) { print OUT @history if /$pattern/; print OUT $_ if /$pattern/; # adds line with match push @history, $_; shift @history; }
Thanks again every one,
Neurotoxx
In reply to Re^5: How can I print three lines before pattern match?
by neurotoxx
in thread How can I print three lines before pattern match?
by neurotoxx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |