Vi ---> Removing blank lines |
:v/./dor
:g/^$/dor
:%!cat -sIf you want to get rid of duplicate blank lines, but leave the first blank line intact, try:
:%!sed /./,/^$/!dBe aware that you may need to get rid of trailing whitespace first. This can be accomplished with
:%s/[ ^I]*$/