Removing empty lines in Notepad++
You need something like a regular expression.
You have to be in Extended
mode
If you want all the lines to end up on a single line use \r\n
. If you want to simply remove empty lines, use \n\r
as @Link originally suggested.
Replace either expression with nothing.
- notepad++
- Ctrl-H
- Select Regular Expression
- Enter
^[ \t]*$\r?\n
into find what, leave replace empty. This will match all lines starting with white space and ending with carriage return (in this case a windows crlf) - Click the Find Next button to see for yourself how it matches only empty lines.
There is a plugin that adds a menu entitled TextFX
. This menu, which houses a dizzying array of quick text editing options, gives a person the ability to make quick coding changes. In this menu, you can find selections such as Drop Quotes, Delete Blank Lines as well as Unwrap and Rewrap Text
Do the following:
TextFX > TextFX Edit > Delete Blank Lines
TextFX > TextFX Edit > Delete Surplus Blank Lines
There is now a built-in way to do this as of version 6.5.2
Edit -> Line Operations -> Remove Empty Lines
or Remove Empty Lines (Containing Blank characters)