[geeks] search and replace

Kurt Huhn kurt at k-huhn.com
Fri Sep 5 13:04:47 CDT 2003


On Fri, 5 Sep 2003 13:23:44 -0400
Kevin <kevin at mpcf.com> wrote:

> I've got an folder full of html docs that reference a
> file in one location and i want to move that file to
> another location.  What i need is a way of replacing
> the string "pic.gif" with the string "images/pic.gif"
> in all of these documents.
> 
> I'm guessing there is someway to accomplish this with a
> bash or csh script but i lack a mastery of either.  Any
> help would be much appreciated.
> 
> Note: i'm sure i could load up all the files into a
> word processor and search and replace but i feel
> certain that there's a more elegant way :)
> 

man sed

in short,
sed s/pic.gif/"images/pic.gif"/g
will probably get you there.  Unless I've typo'd something, that is....

-- 
Kurt                 "I am not aware that any community has a right to 
kurt at k-huhn.com       force another to be civilized." 
                                                   --John Stuart Mill 



More information about the geeks mailing list