[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Collective memory query



On 27 Sep 2004, Dale Amon wrote:
> A couple years ago I ran across a sed like program that will
> recursively descend through a tree and apply specified edits in place.
> I have searched my notes, gone through the deb available and have not
> been able to find it. Might just have been something on SourceForge...
>
> Has anyone else run across a program of this nature?

I don't recall any specific program like that, but wouldn't this do just
fine?

] find . -name '...' -print0 | perl -0pi.orig -e 's/foo/bar/gi'

That will recurse over files, editing them in place using Perl.

Alternately, with sed:

] sed -si.orig -e '...' `find . -name '...'`

More safely, but with more forks:

] find . -name '...' -print0 | xargs -0 sed -si.orig -e '...'

Wrapping your own shell script around that should be trivial.

	Daniel
-- 
Men love to wonder, and that is the seed of our science.
        -- Ralph Waldo Emerson, _Society and Solitude_



Reply to: