Take the 2-minute tour ×

I have the following text in Notepad++. 37 ms N/A Dead N/S Dead N/S 37 ms N/A

How do I do a find and replace that matches "Dead" and eliminates the line with output like the following? 37 ms N/A 37 ms N/A

I have tried to use the regular expression ^.*Dead.*$ that does remove the lines, but it doesn't delete the empty spaces.

share|improve this question

migrated from stackoverflow.com Jun 2 '11 at 22:33

This question came from our site for professional and enthusiast programmers.

Unfortunately it is not the line with Dead that is the problem it is the endline at the end of the previous line before Dead. I am uncertain if you can use a regex to find a line and the endline before it. –  SC Ghost Jun 2 '11 at 21:25

5 Answers 5

You can use two steps:

Use regex to replace matches for ^.*Dead.*$ with markedfordel

Then in extended mode, for matches of markedfordel\r\n replace with empty


enter image description here

share|improve this answer
Good thing you were here, I would have blindly answered saying it could be done with only a regex before actually thinking about it. –  MBraedley Jun 3 '11 at 0:29

Go to the search then to the Mark tab, enter "Dead", check "mark line" and click "Find all". It results in bookmarks for all those lines.

In the search menu there is a point "delete bookmarked lines"

share|improve this answer
I like this answer! –  vsync Jul 1 '11 at 19:51

Combine/enhance/replace your regex with the solutions here: http://superuser.com/questions/35233/delete-blank-lines-from-a-text-file

share|improve this answer

Try a Regex replace in Notepad++ with:


That'll remove the lines for you.

share|improve this answer

You can use your first step to blank the lines that contain "Dead" in them, and then what I usually do is use one of the plugins typically included with Notepad++ to remove blank lines. To do that, I press Ctrl+A to highlight the entire document, then go to the TextFX menu (for the TextFX plugin), go to TextFX Edit, and then select Delete Blank Lines (about halfway down the menu). That will, as it said, remove all blank lines in the highlighted region.

share|improve this answer

Your Answer

