How To Print The Next Line After A Matching Regexp With Sed

How To Print The Next Line After A Matching Regexp With Sed

February 28, 2009
~ $ cat example.txt
first line
second line
third line
another line

~ $ sed -n '/second/{n;p;}' < example.txt
third line

~ $ sed -n '/second/{n;p;n;p;}' < example.txt
third line
another line