Let\'s say I had a text file with the following nine lines:
foo
bar
baz
qux
quux
How can I use Sublime Text 2 to remove all four of the
There are also some ST2/ST3 Plugins for such tasks. I do like these two:
The first one has two methods for removing empty/unnecessary lines. One of them called Delete Surplus Blank Lines
which is cool. It removes only those lines that are followed by another empty line
Simpler than I thought. Ctrl + A Followed by Ctrl + H Then Select Regular Expression .*
. Replace \n\n
with \n
. Voila!
A Find/Replace solution:
Regex Find:\s+
Replace with: //single space
Select the text
Press:
Make sure you have selected 'regular expression' by pressing:
Find what: ^\n
or ^(\r|\n\r?)
Replace With: (nothing, leave in blank).
If ^\n
does not work properly ===> try .*[^\w]\n
Their is a more easily way to do that without regex. you have just to select the whole text. then go to: Edit--> Permute Lines --> Unique.
That's all. and all blank lines will be deleted.