How do I write a sed command to delete a row if it doesn't contain certain words?

Hi
How do I write a sed command to delete a row if it doesn't contain certain words?

ie.
If the line doesn't contain "Houston", "Dallas", or "Austin", I wan to delete the line

Thanks
Jamie
jamie_lynnAsked:
Who is Participating?
 
MazdajaiConnect With a Mentor Commented:
sed -ri '/(Houston|Dallas|Austin)/!d' file

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.