Using vi, how can I delete all lines that contain [searchterm]?


I want to remove all lines in a CSS file that contain the word "color".

This would include:

body {background-color:#000;}
div {color:#fff;}

How would you do that using the :%s/ command?

Is that such a wise idea? You could end up doing something you don't want if your CSS has sections like this

body {background-color: #000;
  font-size: large;

p {
  color: #fff; float: left;

You're better off removing only the properties containing color


Update: As too_much_php pointed out, the regex I didn't exactly work. I've fixed it, but it requires vim. It isn't feasible to forge a regex that only removes problem properties in vi. Because there are no character classes, you would have to do something like replacing the \w with \(a\|b\|c\|d\|....\Z\)