Vim: Delete lines that match a pattern

Delete lines that match the pattern

:g/pattern/d

Delete lines that do not match the pattern

:v/pattern/d  
or  
:g!/pattern/d

Comments