On Wed, Oct 2, 2013 at 5:10 PM, Peter Holsberg
<pjh42atpobox....@gmail.com>wrote:
> Charles DeRykus has written on 10/2/2013 5:49 PM:
> >
> > Wouldn't a manual edit be easier... or is this a recurrent problem?
> > If recurrent, a messy solution may be possible but fragile unless
> > the html formatting is invariant - what if, for instance '</div></body>'
> > appears with whitespace embedded between/inside tags..?
>
> Recurrent.
> Invariant.
>
>
Ok, assuming edit replacements can be done independently, here's a template
that might help:
use File::Slurp; use strict; use warnings;
my $input = read_file("...") or die "can't read ... ";
my $append = read_file("...") or die "can't read ...";
my $token = qr/^<a class="nolinkunderline"\n.*/m;
$input =~ s/$token// or die "can't find $token";
$token = qr/^(<pre>)$/m;'
$input =~ s/$token/$1$append/ or die "can't find $token";
my $replace = << 'END';
...
END
$token = qr{^</div></body>$}m;
$input =~ s/$token/$replace/m or die "can't find $token";
__END__
--
Charles DeRykus