Notepad++ is a free text editor for Windows. Follow the steps below to replace blank lines in a file

Method 1

Go to Edit -> Line Operations -> Remove Empty Lines or Remove Empty Lines (Containing Blank characters)

Removing Empty Lines option in Notepad++

Method 2

Notepad++ supports regular expression search and replace that can be used to replace blank lines in one or more files. Follow the steps below to replace blank lines

  1. Press Ctrl + h to open ‘Replace’ pop up
  2. Write one of the following regex in find what box. [\n\r]+$ or ^[\n\r]+
  3. Leave the ‘Replace with’ empty
  4. Check the Wrap around option.
  5. Select the Regular expression search mode.
  6. Click on the Replace All button.
Find and Replace in Notepad++