The inverse global command
The global command has a cousin, called the inverse global command or :vglobal, that does something slightly different.
The global command finds all of the lines in buffer that match a regular expression and performs an Ex command them.
The inverse global command finds all of the lines in a buffer that do not match a regular expression and performs an Ex command on those.
You can think of the global command as selecting the lines that match a regular expression, whereas the inverse global commands filters out lines that don’t match.
It works in the exact same way as :global/:g — you just use :vglobal/:v instead.
Let’s try this in the editor. Once again, a secret message is hidden amongst the HAYSTACK lines. This time, secret messages lines aren’t uniquely identified by anything — so you’ll have to filter out the HAYSTACK lines and print whatever’s left. You can do this with the :v command.
Once again, if you’re really stuck, jump to the bottom of the buffer to see how it’s done.