Delete blank lines from a text file
I am trying to delete all the blank lines in a text file. Is there a quick way to do this?
What I have
line one
line two
What I want
line one
line two
I am using Notepad++, so a solution using Notepad++ is appreciated.
I have Cygwin too, so if nothing else, a script is fine.
Solution 1:
Use the menu:
1) Select all text (Ctrl-A)
2) TextFX -> TextFX Edit -> Delete Blank Lines
Solution 2:
Macro's can be scary, accidental loss the first chars if its off a line..
- View > Show Symbols > Show End Of Line
Take note that it ends in CR LF (This is Carriage Return and Line Feed which is \r\n) Ctrl+H then enable extended replace "\r\n\r\n" with "\r\n"
It will cycle through and remove the double spacing, you might need to repeat if its more than just double spacing. (Another thing to consider is: Edit > Trim Trailing White Space.)