Regex – How to select (or simply delete) every other line in Sublime Text

regexsublimetext2

If I edit a WordPress template in Sublime Text 2 after it has been edited in the WordPress editor, every other line is blank. I'd like to remove those … del del del del is getting really annoying.

Note this is different from deleting all blank lines (i.e., Sublime Text 2: How to delete blank/empty lines). Some lines are intentionally blank.

Best Answer

Find what: \n\n

Replace with: \n

If the blank lines are odd, put the cursor on line 2. Otherwise, put the cursor on line 1.

Click Replace All