How can I replace empty lines in Notepad++? I tried a find and replace with the empty lines in the find, and nothing in the replace, but it did not work; it probably needs r
^\r\n
with nothing (select regular expression)Note: step 1 will remove your code intendation done via tabs and blank spaces
^[ \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)You know what, now Notepad ++ has inbuilt functionality to do so...
Alt+E
> Press down Arrow > Line Operations > Remove Empty Linesctrl + H
Find :
\r\n\r\n
Replcate with :
\r\n
You can follow the technique as shown in the following screenshot:
^\r\n
keep this empty
Regular expression
NOTE: for *nix files just find by \n