Replacing text within a bunch of files
Ed Wilts
ewilts at ewilts.org
Sat Apr 10 20:21:46 UTC 2004
On Sat, Apr 10, 2004 at 01:17:33PM -0700, Chris wrote:
> Okay, one more small question :-)
>
> Can you force it to apply only to certain files, say *.html ?
Sure - just change the find command.
>
> It's trying to do this in binary files and all sorts of files that
> either won't have the string I'm trying to replace, or should not even
> attempt to modify such other files - just html documents.
find -name '*.html' -type -f
find has a *lot* of options that let you be as specific as you want to
be.
.../Ed
> ----- Original Message -----
> From: "Chris" <redhat-list at dotcomdesigners.com>
> Sent: Saturday, April 10, 2004 1:10 PM
> Subject: Re: Replacing text within a bunch of files
>
>
> > Thanks Ed!!
> >
> > That works perfectly.
> >
> > Adam
> >
> > ----- Original Message -----
> > From: "Ed Wilts" <ewilts at ewilts.org>
> > Sent: Saturday, April 10, 2004 12:49 PM
> > Subject: Re: Replacing text within a bunch of files
> >
> >
> > > find -type f | xargs -n 1 replace old_string new_string --
> > >
> > > The latter will do an inplace replacement.
--
Ed Wilts, Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program
More information about the redhat-list
mailing list