On Tue, Jan 09, 2001 at 12:54:34AM +0800, csj wrote:

:for i in *.txt ; do mv $i $i.tmp ; sed s/foo/boo/g $i.tmp > $i ; done
:
:Can anybody comment on this little script? This appears to work, but 
:may be inefficient. And it's one step removed from what I want, 
:recursive processing. That is, to have sed process files in 
:subdirectories of the current directory. I prefer something that can 
:receive its input from find:
:
:find . -name *.txt

My vote for most elegant:

find . -name *.txt -exec sed s/foo/boo/g {} \;
                {} refers to file found  ^  ^must have \; to terminate
                                             -exec

-Jon

Reply via email to