in reply to perl one line for advanced grep (current line and next one)
perl -ne 'print $_.=<> if /string/' testfile
Nice, but it misses the line following a second consecutive line matching the pattern
# eg this works as expected
# this one fails to print test2
Once (shame on you!)
Twice (shame on me!)
More often than I'd like to be
All the time
Just when answering stupid polls
Who you callin' a fool?
I refuse to vote in this ridiculous poll
Results (467 votes). Check out past polls.