Remove all blank lines using Vim

Remove blank lines using Vim is very simple,


:g
will execute a command on each line that matches a regex
the regex “blank line” is ^$
the command is :d
so to remove all blank lines from a text file issue the following command:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *