in reply to how to next line after the pattern in perl
I prefer moritz's solution (while (<>) { $f and print; $f = /XXXX/; }) to lidden's, because it works well even if the pattern matches two consecutive lines.
See also my cgrep: Egrep clone with function name display for something similar, it can do context grep, that is, print a number of lines after and before a line matching a pattern.
|
|---|