Search & Replace Issue

Randy Pratt bsd-unix at earthlink.net
Sat Dec 23 23:17:13 PST 2006


On Sat, 23 Dec 2006 21:29:40 -0600
"Jack Stone" <antennex at hotmail.com> wrote:

> Appreciate a tip on how to search & replace  hundreds of *.htm files:
> 
> >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.

Probably many ways to do this but I typically use sed to edit
files in-place:

	sed -i "" 's/http:\/\/www.domain.com\///g' *.htm

Randy
-- 


More information about the freebsd-questions mailing list