vi global delete

We have a text file we need to delete lines which match a latter.

:g/<STRING>/

This will now show you the lines that match your STRING

If this looks ok - then

:g/STRING/d

And they are gone !!

Not Matching

Lets see all lines with the word tim in them

:g/tim/

So all lines without the word tim is written as

:g!/tim/