Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I use the find and replace function in notepad to delete multiple blank lines in a text file?

share|improve this question
    
So only if there's more than one blank line between paragraphs? –  Arjan Sep 28 '09 at 9:00
add comment

4 Answers

Within notepad there is no way to use the Find and Replace and target blank lines. Consider Notepad++ and the regex search and replace.

You can use \r\n to find blank lines from text files made within Windows, \r for Mac and \n for Linux.

I believe a default install actually comes with TextFX to make your life even easier, it has an option to delete blank lines:

alt text

share|improve this answer
2  
Sounds to me that the next option, "Delete Surplus Blank Lines" might be what's needed here? (The question asker is not too clear about that, but otherwise the question could read: "How to delete a single blank line, and repeat that multiple times".) –  Arjan Sep 28 '09 at 8:58
    
Good answer, but it might as well be noted that Mac OS X uses \n to terminate lines, not \r as classic did. –  jtb Sep 30 '09 at 5:04
add comment

since the original notepad is a real pita (and everyone else is suggesting their own fav anyway):

vim ftw with:

:g/^\s\+$/d
share|improve this answer
add comment

I think you can't do it in notepad; when I have such a problem, I open the text file with Word (any other word processor should go) and replace two consecutive paagraph marks with one of them. Repeat several times (until there is nothing more to replace) and you're done.

You should replace ^p^p

with ^p

share|improve this answer
add comment

There is a AutoHotKey tooltip extension for the purpose.
But, you could also change to Notepad++ and get better control.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.