, , , , , , ,

Here are two ways to delete the blank lines in a text file opened with vim:

1. Delete all the blank lines with NO white spaces other than new lines:


2. Delete the blank lines containing any type of white spaces:


BONUS: Remove only multi blank lines (reduce them to a single blank line) and leaving single blank lines intact:


Reference: Stack Overflow.