This tutorial explains about the removing blank lines using regular expression. Here I have used the TextPad Editor to do this.
For Example, the contents of the file is as follows , with lot of blank lines. We will see how we can remove this using TextPad
Select Search -> Replace or F8 (keyboard shortcut)
Select the option shown below, in the “Find what” field enter “^\n” (without the quotes), and then click on “Replace All” button.
This screenshot shows the final outcome of the text file.
What does the “^\n” mean ?
In regular expression “^” indicates the start of the line, “\n” is end of line, so “^\n” is that any line starting new line character , replace with blank character.