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

February 2009 ยท 1 minute read

~ $ 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
comments powered by Disqus