How do I delete all blank lines in a file? How do I remove all the
lines containing only space characters? To remove all blank lines, use the following command:
:g/^$/d
To remove all lines with only whitespace (spaces or tabs) in them, use the following command:
:g/^\s\+$/d
To remove all the lines with only whitespace, if anything, use the following command:
:g/^\s*$/d
Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.
Introduction to Recursion and Backtracking