[oclug] ...and speaking of awk...
Kirrily Robert
skud at e-smith.com
Thu Feb 22 16:44:42 EST 2001
On Thu, Feb 22, 2001 at 03:55:11PM -0500, Adrian Chung wrote:
> On Thu, Feb 22, 2001 at 02:45:45PM -0500, Dave Edwards wrote:
> > Hey Gang,
> >
> > I need to alter a directory worth of downloaded html files so that the
> > links reference only ./ "this directory." But I can't wrap my head
> > around the re necessary to do this. In very loose pseudo, it would be:
> >
> > when, in any field, <a href="http://some.url/file.html"> is found, replace
> > that with <a href="./same-filename.html">
>
> Try this:
>
> perl -pi -e 's/http:\/\/some.url/\./g'
Perl accepts alternative regexp delimiters on m// and s///, as my own
and Dave O'Neill's examples showed. So to avoid escaping all those
backslashes, just use something like:
s!http://blahblah!foo!
or
s{http://blahblah}{foo}
K.
--
Kirrily "Skud" Robert
skud at e-smith.com (work)
skud at infotrope.net (home)
More information about the OCLUG
mailing list