Remove Empty Lines in Sublime Text

 

https://www.shellhacks.com/sublime-text-remove-empty-lines/

Here is a step by step instruction for how to remove empty lines in the Sublime Text editor:

  1. Go to the  Find →  Replace
    – or – press the Ctrl + H  on Windows/Linux or ⌘ Cmd + Alt + F on Mac
  2. Select the ‘Regular expression‘ by clicking on the .* button in the  Find box
    – or – press the Alt + R on Windows/Linux or ⌘ Cmd + Alt + R on Mac
  3. In the  Find field, type in:
    ^\n to delete empty lines excluding the ones that contain whitespaces:
    – or –  ^(\r|\n\r?) to delete empty lines including ones with whitespaces:
  4. Leave the  Replace field empty
  5. Click on the Replace All button
^(\r|\n\r?)