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

Re: recusive ls/search/replace function!!



On Tue, 2005-04-26 at 15:17 -0700, bruce wrote:
> hi..
> 
> can't figure this out. it's basic.. how can i do a find of all files in
> underlying recursive dirs. also, how can i do a search/replace of txt in all
> files that match a certain extension..
> 
> ie, how do i find all files that end in 'int' in the underlying dirs...
> or, how do i replace "foo' with 'dog' in all underlying dirs that end in
> 'ddf'..
> 
> i can see that 'ls -R * can/should get me all underlying files... but...
> 
> i can also see that find . -name "*.int" would work to find the files... but
> i'm not sure how to get the rest.

You're probably after something like:

$ find . -name '*.int' -exec sed -i -e 's/foo/dog/g' {} \;

Paul.
-- 
Paul Howarth <paul city-fan org>


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