3

Is there a way to delete the whole line if it contains specific word using sed? i.e. I have the following:

aaa bbb ccc

qqq fff yyy

ooo rrr ttt

kkk ccc www

I want to delete lines that contain 'ccc' and leave other lines intact. In this example the output would be:

qqq fff yyy

ooo rrr ttt

All this using sed. Any hints?

Community
  • 1
  • 1
  • 1
    Does the answer below solve your problem? Than you could accept it. –  Sep 19 '12 at 08:22

1 Answers1

7
sed -n '/ccc/!p'

or

sed '/ccc/d'
hroptatyr
  • 4,702
  • 1
  • 35
  • 38