Extracts certain rows from a file Print lines which does no contain 'n': $ sed -n '/n/!p' file Print lines which contain 'a' or 'b': $ sed -n '/[ab]/p' file