[Next] [Up] [Previous] [Contents]
Next: Writing from buffers Up: Miscellaneous tips Previous: Additional search and

Removing blank lines

Blank lines can be removed from a file with any of the following:


    :v/./d
or


    :g/^$/d
or


    :%!cat -s
or


    :%!sed /./,/^$/!d
Be aware that you may need to get rid of trailing whitespace first. This can be accomplished with


    :%s/[ ^I]*$/!d

c.c.taylor@ieee.org