[oclug] ...and speaking of awk...

Vic Gedris vic at worldwidepunk.com
Thu Feb 22 15:22:48 EST 2001


> 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">
> >
> > Phew!  Any help would be appreciated.  Thanks as always,

The shell script version of this can easily make use of sed:

$ sed -e 's/http:\/\/some.url/\./g' file.html

Now just stick that in a script that loops through all files.

Cheers,
Vic

-- 
------------------------------------------------------------------------
vic at worldwidepunk.com    WORLD WIDE PUNK    http://www.worldwidepunk.com
------------------------------------------------------------------------




More information about the OCLUG mailing list