Page 1 of 1

Want to delete an entire line if an item is found

Posted: Mon Jan 31, 2005 5:32 pm
by darren
Hello,

I want to search for a word and delete the entire line if the word is found. Please let me know how to do that.

Thanks!

Posted: Mon Jan 31, 2005 5:32 pm
by Abacre
Read the page with exact answer:
http://www.abacre.com/afr/manual/regexpfaq.htm

Re: Want to delete an entire line if an item is found

Posted: Mon Jan 31, 2005 5:32 pm
by Darren
darren wrote:Hello,

I want to search for a word and delete the entire line if the word is found. Please let me know how to do that.

Thanks!


Thanks very much for the speedy response! I still have two issues. In the example that you answered with, it does not do all that it states. If you try it, it deletes all of the first two lines but not all of the last occurance. Strange.

Also, on my issue, here is the example:

<html>
<head>
<title>John Doe</title>
</head>
<BODY BACKGROUND=back.gif TEXT=#000000 LINK=#0000ff>
<CENTER><TABLE WIDTH=550 border=0><TR><TD><center>
<h1>John Doe</h1>
</center>
<hr size=7 width=95%>

I use john.*\r\n and it does not do anything when executed.

Thanks!

Posted: Mon Jan 31, 2005 5:32 pm
by Abacre
Try this:

^.*john.*\r\n

so:
^ means start of the line
.* - any char