sed print only line AFTER string match

sed -n '/pattern/{n;p;}' infile

File

# cat infile
line 1
line 2
pattern
line 3
line 4

Example

# sed -n '/pattern/{n;p;}' infile
line 3
This entry was posted in Command Line FU and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *