Search & Replace Issue

perryh at pluto.rain.com perryh at pluto.rain.com
Sun Dec 24 17:38:26 PST 2006


> >> From this:
> > <li><a href="http://www.domain.com/tales/wouf.html
> > To this:
> > <li><a href="tales/wouf.html
> >
> > In other words, I just want the relative path and remove all
> > the extra: http://www.domain.htm/  portions of the lines.
...
> cat file.html | sed -e "s|http://www.domain.com||g" > file.tmp.html && 
> mv file.tmp.html file.html

I don't think the "cat" accomplishes anything in a case like this
(and BTW he also wanted to remove the / after com):

sed -e "s|http://www.domain.com/||g" < file.html > file.tmp.html ...

Additional logic (or use of -i) may be desirable to avoid loss of
file ownership and permission settings.


More information about the freebsd-questions mailing list