http://www.perlmonks.org?node_id=1051863

sroux has asked for the wisdom of the Perl Monks concerning the following question:

Dear guruz, Is there any way of doing a one liner grep and displaying the matching lines but also the next line? > This would interests me (unix version with -A option) : $ grep -A1 error file test_log.txt I found this basic one liner grep : perl -nle "print if /error/" test_log.txt Many thanks for lightening my path.