how to search/replace text in mutliple files?

John V. Pope jpope_rhn at popes.net
Wed Feb 11 19:25:29 UTC 2004


On Wed, Feb 11, 2004 at 03:10:14PM -0400, Trevor Smith wrote:
> On February 11, 2004 09:33 am, Piero Calucci wrote:
> > btw if you are going to _replace_ text you should better look at sed or
> > perl one-liners
> 
> Dude, that was exactly the plan. But I couldn't get sed to *find* the text, 
> let alone replace it, so I concentrated on figuring out the regex (with grep) 
> and couldn't, so I emailed you. :-)
> 
> Now, how I am going to search/replace multi-line blocks of HTML in files using 
> sed? Good question. I'm afraid the power of sed has not been my friend (too 
> new to this).
> 
> -- 
>  Trevor Smith    |    trevor at haligonian.com 
> 
> 
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
Trevor,

Try using find to locate the files and run sed on each file.

i.e.
 find . -exec "sed 's/oldtext/newtext/g'" ...

John V. Pope





More information about the users mailing list