in reply to Search and replace in html
#!/usr/bin/perl -w use strict; open (INPUT,"file") or die "Unable to open input : $!"; open (OUTPUT,">output") or die "Unable to open outpu : $!"; select OUTPUT; $\ = "\n"; my $foundstart; while (<INPUT>) { chomp; next unless ($foundstart || /<html *>/i); if (/<html *>/i && ! $foundstart) { $_ =~ s/^.*?<html *>(.*)$/$1/i; $foundstart++; next unless($_); } if ($_ =~ m|</html *>|i) { $_ =~ s|^(.*?)</html *>.*$|$1|i; print if($_); last; } print; } close INPUT; close OUTPUT;
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Search and replace in html
by Anonymous Monk on May 09, 2003 at 01:16 UTC | |
by Limbic~Region (Chancellor) on May 09, 2003 at 12:56 UTC |