From owner-freebsd-questions Thu Jul 10 06:08:32 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id GAA01101 for questions-outgoing; Thu, 10 Jul 1997 06:08:32 -0700 (PDT) Received: from po3.bbn.com (PO3.BBN.COM [192.1.50.37]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA01093 for ; Thu, 10 Jul 1997 06:08:29 -0700 (PDT) Received: from bbn.com (DROCKWELL.BBN.COM [128.89.31.139]) by po3.bbn.com (8.8.5/8.8.5) with ESMTP id JAA01957; Thu, 10 Jul 1997 09:05:52 -0400 (EDT) Message-Id: <199707101305.JAA01957@po3.bbn.com> To: Simon N Atkin cc: freebsd-questions@freebsd.org Subject: Re: SED remove from live file In-reply-to: Message from Simon N Atkin <33C3F7B9.5636@enta.net> . X-face: &R'hN{mZu#r@8b_JU\bn"!fYpP{?5k4p/(|]?.2'6;>Dc9}~t*vY=/#-:"63ya.%)%o`Kv$ u&'Ff5k&n[}QC;j7YYsR5Hl]G"E:*9Zmw;dx[sw&9Tmx_PB/7B`RdFW;#@49hJU&kW+J"<[`9^?.dQ 3]L$zK,4'=tThX$wC!M\`e*@1y Date: Thu, 10 Jul 1997 09:08:24 -0400 From: Dennis Rockwell Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On 9 Jul, Simon N Atkin wrote: > Anyone know how to remove a certain string from a file > without having the create a tmp file. > > i.e sed "s/\.//g" simat.dat strip all . 's from simat.dat Sheesh, you guys. I must've started with UNIX too long ago, back when "ed" was useful. The simplest way is *not* to use sed, but use "ed -" instead: echo '1,$s/\.//g\ w\ q' | ed - simat.dat This quoting works for tcsh; YMMV. Yes, yes, ed will create a temp file, but not in the current directory, and it takes care of deleting it for you. The renaming suggestions momentarily suck up twice as much space in the current directory. Why do you want to avoid the temp file? Is "simat.dat" waaay too big or something? Or were you avoiding the cleanup? Dennis Rockwell dennis@bbn.com Bolt Beranek & Newman Systems & Technologies +1-617-873-5745 Cambridge, MA +1-617-873-6091 (Fax)