I'll bet the solution is very simple, but i've no clue what it is. Any
help would be appreciated.
Sample text to replace:
<A HREF="blah.com">
<IMG SRC="blah.gif">
<BR>
That's a picture!
Perhaps a shell script could be used? I'm not sure, tho i tried
playing round with one, no luck there either...
-Hitmyed Gainstde Brickwall
Perl can be told to read from a file and perform substitions without regard
to line breaks.
--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Not directly. With sed, awk, perl (among others) you can effect this
with constructs that they offer, but not with the default behavior.
For example, in sed, if you want to match the lines "foo",
"bar", "baz", and when matched replace them with "ding!":
sed '/^foo$/!b
N
/\nbar$/!{
P
D
}
N
/\nbaz$/!{
P
s/[^\n]*\n//
P
D
}
c\
ding!
'
Or in perl:
perl -pe 'continue if $_ ne "foo\n";
my $n = <>;
if ($n ne "bar\n") {
print $_;
$_ = $n;
redo;
}
my $m = <>;
if ($m ne "baz\n") {
print $_, $n;
$_ = $m;
redo;
}
$_ = "ding!\n";'
--Ken Pizzini