This will print out the matched line, and then the three lines following it. This, if I understand correctly, is what you are trying to do.
open(FILE,"dumptape.log") or die ("Could not open file"); while(<FILE>) { if (/Dump phase number 3/) { print; print <FILE> for (1..3); last; } } close FILE;
</ajdelore>
In reply to Re: Finding and extracting lines of text
by ajdelore
in thread Finding and extracting lines of text
by mikevanhoff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |