Article View: comp.sys.next.misc
Article #803Re: filtering a text file
From: Mark Neidengard
Date: Thu, 06 Aug 1992 20:54
Date: Thu, 06 Aug 1992 20:54
41 lines
1937 bytes
1937 bytes
In article <1992Aug6.102953.8775@darkcube.radig.de> vhs@darkcube.radig.de writes: >In article <BsFuBt.D8I@news.cso.uiuc.edu> Melman@uiuc.edu (Melvin Wilson) >writes: >> Hello, >> >> Help! >> >> I have a very simple (and for the more experienced, stupid) question. >> >> From the command prompt on a NeXT how could I search a text file and remove >> every instance of a particular expression in that text file? I've tried but >I >> cannot figure out the apropriate format of the command. > >type > <inputfile >outputfile sed 's/old/new/g' >replacing inputfile and outputfile with their respective values. >The expression "old" will be replaced by "new". If old or new contain >any / characters, use a different character in the sed expression instead, like > sed 's:old:new:g' > >-- >Volker Herminghaus-Shirai (vhs@darkcube.radig.de) > >Computer industry: Industry in which the number of units sold of any >given product is inversely proportional to its technical excellence. >See also: MS-DOS, Windows, IBM-PC, X, QWERTY, 80x86. The easy way to REMOVE things using sed is to replace them by a null. This is accomplished by saying: 'cat oldfile | sed s/searchstring//g > outputfile' This will QUICKLY remove every instance of your searchstring by replacing it with NOTHING =) Have fun! Mark Neidengard mneideng@cosmos.aca.calpoly.edu
Technical Details
Message-ID:
<1992Aug06.205458.112586@zeus.calpoly.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sal.wisc.edu!rat!zeus!rootReferences:
<BsFuBt.D8I@news.cso.uiuc.edu> <1992Aug6.102953.8775@darkcube.radig.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sal.wisc.edu!rat!zeus!root From: mneideng@thidwick.acs.calpoly.edu (Mark Neidengard) Newsgroups: comp.sys.next.misc Subject: Re: filtering a text file Message-ID: <1992Aug06.205458.112586@zeus.calpoly.edu> Date: 6 Aug 92 20:54:58 GMT References: <BsFuBt.D8I@news.cso.uiuc.edu> <1992Aug6.102953.8775@darkcube.radig.de> Sender: news@zeus.calpoly.edu Organization: Academic Computing Services, Cal Poly San Luis Obispo Lines: 41