Delete lines containing a pattern in vim

on January 08, 2020. in Software, Development. A 1 minute read.

Today I had to delete all lines from a CSV file where the last column has a 1:

:g/1$/d

While short, I can’t remember this syntax as I have to search for it every time. I’ll try to remember this as “grep for a pattern, and delete” for next time.

Happy hackin’!

Tags: vim, grep, delete.

Get the next article to your inbox

If you'd like, you can get the next article I write to your email inbox.