Re: Command line search and replace
On Mon, Jan 08, 2001 at 11:52:26PM -0800, kmself@ix.netcom.com wrote:
:> My vote for most elegant:
:>
:> find . -name *.txt -exec sed s/foo/boo/g {} \;
:> {} refers to file found ^ ^must have \; to terminate
:> -exec
:
:This solution doesn't create an output file for each input file, as
:requested.
I must have joind the thread late as I don't see that requirement,
simply fixed by assing another -exec clause,
find . -name *.txt -exec cp {} {}.tmp \; -exec sed s/foo/boo/g {} \;
or writing a small shell/perl/sed/awk/whatever script that take the
original file as input ad -exec'ing that.
-Jon
Reply to: