How to delete blank/empty lines in Sublime Text

I find my self using Sublime Text on everyday basis, either I take some notes, or I work on a project, Sublime Text is my editor of choice. It’s free, it’s powerful and helps me to get the job done.

Sometimes I find my self working on a existing project or WordPress theme, and some times there are some empty/blank lines in the files. I recently find out that it’s actually very easy to delete those lines, without to many headaches. For example your file may look like this:

and you want your file using a simple operation to look like this

All you have to do is to follow bellow instructions and you are done:

On Windows press:

CTRL + H

or Click Find->Replace – from the top navigation menu

Make sure you have selected ‘regular expression’ by pressing:

Alt + R

or Click .* in the Find box.

In the Find What: field type: ^n and Replace With: field leave it blank.

On Mac press:

Command + ALT + E

or Click Find->Replace – from the top navigation menu

Make sure you have selected ‘regular expression’ by pressing:

Command + Alt + R

or Click .* in the Find box.

In the Find What: field type: ^n and Replace With: field leave it blank.
And you’re done.