Untested code:
(In the RegEx, I replace / with . because it should work fine and looks less
messy - and . is not escaped.)


# File - source
open FILE, "< file.html";
my $delete = 0; # Start by not deleting
my $output = "";
my $deletedAlready = 0;
my $searchString = '<h4 class="post-title"><a href="
http:..domain.com.2006.08./bourne-shell.html<http://domain.com/2006/08/bourne-shell.html>">Bourne
Shell<.a><.h4>';
my $stopString = '<p><a
href="http:..domain.com.2006.08./bourne-shell.html<http://domain.com/2006/08/bourne-shell.html>">Sáb,
14 Abr 2007 12:31:07<.a><.p>';

# Loop through file
foreach ( <FILE> ) {

 # See if we should start deleting - if we didn't already
 $delete = /$searchString/ if (not $delete and not $deletedAlready);

 # Add the input to the output if not being deleted
 $output .= $_ . "\n" if (not $delete);

 # If deleting, see if it should turn off
 $delete = 0 if ($delete and /$stopString/);
}

On 4/15/07, Mário Gamito <[EMAIL PROTECTED]> wrote:

Hi,

I have this site that auto generates an index.html file every 15 minutes
(it's a blog aggregator).

I need that every time the file is generated, all the contents between
the lines
<h4 class="post-title"><a
href="http://domain.com/2006/08/bourne-shell.html";>Bourne Shell</a></h4>

and

<p><a href="http://domain.com/2006/08/bourne-shell.html";>Sáb, 14 Abr
2007 12:31:07</a></p>

to be deleted (including these two ones).

I've tried several ways and googled but i can't do the trick.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito
--
:wq! Mário Gamito

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



Reply via email to