Home » Questions » Computers [ Ask a new question ]

Find and replace multiple blank lines

Find and replace multiple blank lines

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

Asked by: Guest | Views: 326
Total answers/comments: 2
Guest [Entry]

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

vim ftw with:

:g/^\s\+$/d"
Guest [Entry]

"7 Step Excel Solution:

Objective: Filter out all rows with data, leaving only the blank rows and then delete those blank rows.

Copy your text file (Ctrl-A to select all and Ctrl-C will copy it) and paste into MS Excel, cell A1
Highlight all rows with data in it. (with the cursor in cell A1 press Ctrl-shift-end)
With the data highlighted, click on the Data tab, then click on Filter. (Cell A1 now has a drop down box on it.)
The first item in the drop down box is ""Select All"" (uncheck it)
The last item in the drop down box is ""Blanks"" (check it)
(The worksheet now looks blank, all your data is hidden except for the blank lines in your data.
Look at the row numbers on the left. The first row in your data with a blank in it is now at the top of your spreadsheet. Let's say it is line 330. The next line could skip to say line 775, the next line in your data with a blank and so on.)
Place your cursor in cell A330. Press Ctrl-Shift-End. Which will highlight all blank lines in your data.
While keeping the cursor in the highlighted area, Right click and select delete row. (Now would be a good time to go back and put the check mark back in the ""Select All"" box.)"