In Vim I often find I'm only interested in lines containing a certain string of text and want to delete all other lines.
It's easy to match lines containing a string:
What I normally end up doing is two passes, one to "flag" all the lines I want with a special first character:
And in the second pass it's easy to do a negative match for one character in a fixed position, so I delete all the lines without my string thus:
But isn't there a much more straightforward way to do this with just a single pass? What am I missing?