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

Re: Command line search and replace



on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx (jon@ai.mit.edu) wrote:
> 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.

Still doesn't work -- sed doesn't change files in place, it reads from
file and writes to stdout.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
  What part of "Gestalt" don't you understand?      There is no K5 cabal
   http://gestalt-system.sourceforge.net/        http://www.kuro5hin.org

Attachment: pgpYfC_EDzq5v.pgp
Description: PGP signature


Reply to: