Pages

Friday, October 28, 2022

Delete every line that DOESN'T match a pattern in VIm

VIm remains one of my most useful tools.

:v/pattern/d

From a somewhat useful SO comment:

Fwiw -- Looks like g [in a command like :g/pattern/d] is for "global" and v [like we have here] is for "inverse" (if you believe what you read on vim.famdom).