How to delete all lines that do NOT contain a certain word in Vim?
You can use
:g!/price/d
to delete every line that doesn't contain "price"
As answered below, g!
is an alias to v
. this is equivalent to
:v/price/d
You can also use:
:v/price/d
to delete lines.