I use vim to remove all lines except those that match a particular string, e.g.
:g!/[string that I want to remain in the editor]/d
Works great. But what I really want, and haven't found anywhere, is a way to use vim to remove all except for multiple strings.
For example, let's say I have a file open with the following information:
Dave came at 12PM
Lucy came at 11AM
Trish came at 5PM
John ate lunch at 2PM
Virgil left at 3PM
Dave left at 6PM
and I want to only be left with events that mention Dave and John -- what vim command could I use to just end up with:
Dave came at 12PM
John ate lunch at 2PM
Dave left at 6PM
I realize I can use command-line tools like findstr in Windows and others in *nix, but I'm in vim pretty often and haven't been able to some up with any regex or vim command that will do this. Thank you!