sed delete lines not containing specific string

This might work for you:

sed '/text\|blah/!d' file
some text here
blah blah 123
some other text as well

Leave a Comment