cat, pipes, and filters

Bruno Pillard bp at chorus.fr
Mon Jun 3 19:43:04 AEST 1991


>From article <1991May31.165446.1530 at progress.com>, by root at progress.COM

>    However, the following command gives me the result I want:
> 
>    cat $FILE | sed s/"$ENTRY"/"$NEWENTRY"/ | tee $FILE 1>/dev/null
> 
>    Any enlightenment would be appreciated. 

What about:

  ( /bin/rm $FILE ; sed  s/"$ENTRY"/"$NEWENTRY"/ > $FILE ) < $FILE

I understand that this may look harmful at first glance because of the
/bin/rm of your precious file but it  works perfectly for  me under sh
and (t)csh.

Is there any problem using that construction ?

   __                       
  /  )                        Bruno Pillard
 /--<  __  . . __   __        Chorus Systemes
/___/_/ (_(_/_/) )_(_)        6 Avenue Gustave Eiffel
                              78182  St-Quentin-en-Yvelines-Cedex  France
bp at chorus.fr  (Internet)      Tel: +33 (1) 30 64 82 13



More information about the Comp.unix.shell mailing list