-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The sed utility has an option to edit a file "in place" so you don't need the temp file. I think it is -i to do that. On Tue, Aug 28, 2007 at 09:00:03PM +0100, Gaijin wrote: > > Chris Norman <chris,norman4&ntlworld,com> wrote: > > > I am writing a bash script. Part of the script involves deleting one > > line of a file, which will be located anywhere in the file. > cat <file> | grep -i "<text>" >temp-file> > mv <temp-file> <file> > > The above does an inverse grep, displaying everything BUT the line > of text you specify, and redirects the output to a temp file. Then it > moves the newly created temp file onto the original file, overwriting > the original. The sed equivalent would probably be: > > cat <file> | sed 's/<text to delete>//' > <output-file> > > If you want to remove more than one line with matching text, add > the 'global' modifier to it: > > cat <file> | sed 's/<text to delete>//g' > <output-file> > > Boning up on 'Regular Expressions' will help in this regard. HTH, > > Michael > _______________________________________________ > Speakup mailing list > Speakup at braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup - -- The Moon is Waning Gibbous (99% of Full) My new web site location is at: http://hallenbeck.ftml.net College, that fountain of knowledge, where everyone goes to drink. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFG1TkE0maTgpPXM9cRAnwnAJ4slj+WiDLOhSZxjTfpYiOhLiVGIwCffJvv n0dkOr2tOTfKS0wJy4EyfBk= =HVn9 -----END PGP SIGNATURE-----