on Mon, Jan 08, 2001 at 01:42:08AM +0800, eechi von akusyumi ([EMAIL 
PROTECTED]) wrote:
> suggestion:
> 
> cat file | sed s/search/replace/gi >file2;cp file2 file1;

Note that this solution creates an additional process for each file
handled.  The more elegant solution is:

    $ sed -e '/search/s//replace/g' < file > file2 && mv file2 file1

My own preferred MO for the whole situation is to create an output
directory, so that duplicates of the files are created and can be tested
and/or checked before the originals are deleted:

    $ mkdir output
    $ for file in <pattern>
    > do sed -e '/foo/s//bar/g' < $file > output/$file; done

-- 
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: pgpVFv4T7ueny.pgp
Description: PGP signature

Reply via email to