Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
open (FILE, $filename); while(<FILE>){ # walk each file my $line = $_ ; chomp $line; #grabbing and printing everything between the body tags if (/<body.*?>/i ... /<\/body.*?>/i){ # this is a body line # extract the body ##changing .html to .asp in the links if ( grep(/a href.*\.html/,$line) ){ (my $newline = $line ) =~ s/\.html/\.asp/g; print OUTFILE $newline . "\n"; } $body_temp = $_; $body_temp =~ s/(.*?)\<body\>(.*?)\<\/body\>/$2/i; chomp($body_temp); $body = "$body_temp" ; # Write the body to the output file print OUTFILE $body . "\n"; } } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing duplicate line
by chromatic (Archbishop) on Apr 30, 2001 at 23:12 UTC | |
by Chady (Priest) on Apr 30, 2001 at 23:48 UTC | |
by Anonymous Monk on Apr 30, 2001 at 23:18 UTC | |
|
Re: Removing dublicate line
by astanley (Beadle) on Apr 30, 2001 at 23:21 UTC | |
by Anonymous Monk on Apr 30, 2001 at 23:33 UTC | |
|
Re: Removing dublicate line
by rchiav (Deacon) on Apr 30, 2001 at 23:24 UTC | |
|
Re: Removing duplicate line
by Chady (Priest) on Apr 30, 2001 at 23:44 UTC |