Files contain empty lines, If the file size is very small, You can delete it manually.
If the file contains a thousand lines, You want to find and remove empty lines.
It is very difficult and time-consuming to do it manually.
Notepad++ provides Find and replace feature to search and replace the text or patterns of text with new text.
How to Remove Empty or blank lines in Notepad++?
There are multiple ways you can remove the lines.
-
Use Line Operations
-
Open file in Notepad++ Editor.
-
Select Edit> Line Operations > select One of it
- Remove Empty Lines
- Remove Empty Lines( Containing Blank Characters)
-
It removes the empty or blank characters line from the entire file
The only disadvantage of this approach is, It will not work with part or selection of text in a file.
- Find and Search with regular expression
Find and search is an inbuilt feature in the editor.
-
Open
Search
>Replace
or use ShortcutCtrl + H
-
It opens
Replace
Window -
Select and type below
Find What
with^\R
- for blank lines,^\h*\R
for blank lines with empty characters)Replace with
empty- Check Wrap Around
- Select Search Mode as
Regular Expression
- Click on
Replace All
button.
-
Use TextFx plugin
- First,
TextFx
plugin - Select TextFx >TextFX Edit > Select
Delete Blank Lines
orDelete Surplus Blank Lines
- It removes empty lines and blank characters in empty lines.
- First,