From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 24-148-111-2.ip.mhcable.com ([24.148.111.2] helo=smtp.mhcable.com) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1DSjin-0005sh-00 for ; Mon, 02 May 2005 18:49:01 -0400 Received: from localhost (localhost [127.0.0.1]) by deliver.mhcable.com (Postfix) with ESMTP id 241ECE71A8 for ; Mon, 2 May 2005 18:49:00 -0400 (EDT) Received: from smtp.mhcable.com (localhost [127.0.0.1]) by localhost (VaMailArmor-2.0.1.16) id 03724-2A4EF587; Mon, 02 May 2005 18:49:00 -0400 Received: from hhs48.com (24-105-197-112.cm.mhcable.com [24.105.197.112]) by smtp.mhcable.com (Postfix) with ESMTP id CCAE8E71A8 for ; Mon, 2 May 2005 18:48:59 -0400 (EDT) Received: from chuckh (helo=localhost) by hhs48.com with local-esmtp (Exim 4.50) id 1DSjim-0001Tj-1y for speakup@braille.uwo.ca; Mon, 02 May 2005 18:49:00 -0400 Date: Mon, 2 May 2005 18:48:59 -0400 (EDT) From: Charles Hallenbeck To: "Speakup is a screen review system for Linux." In-Reply-To: <05b801c54f59$c31a6de0$6401a8c0@geekspeak> Message-ID: References: <002001c54f54$c8466170$c2a9e744@nedelko83f1172> <20050502205023.GA10916@taylor.homelinux.net> <05b801c54f59$c31a6de0$6401a8c0@geekspeak> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-AntiVirus: checked by Vexira MailArmor (version: 2.0.1.16; VAE: 6.28.0.18; VDF: 6.28.0.106; host: smtp.mhcable.com) Subject: Re: can't invoke sed properly... X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2005 22:49:01 -0000 Sed has an option to edit a file "in place" with an optional backup created if you need one. The option is -i and it has worked fine for me. Sed has also been able to edit files with lines that are 32K in length, although I used it as a filter in that application and did not try to "in place" option. On Mon, 2 May 2005, Laura Eaves wrote: > Be careful putting the output into the same file as the input. > Note that I/O redirection takes place before the programs start running, so > cat will open myfile and the shell will redirect the output to the input of > sed, and before sed or cat ever start running, the shell will clobber the > output file if it exists to make way for the output of sed. > Just use different names and later move the file back to the original if you > want it updated. > Oh and you don't use the -e option -- I don't remember what version of sed I > was using when I ran that. > But the -e option is useful if you have several patterns to apply to each > input line. sed will read the -e options left to right and treat each > pattern as being on one line. Of course you could always just use a quoted > pattern that ran over multiple lines, but it is cleaner to use -e. > > Finally, be careful using sed or any other pattern matching command, that > you use single quotes instead of double quotes on the command line, as using > double quotes will result in some undesired translation. For example: > > sed "1,$d" > > will actually translate to > > sed "1,xyz" > > where xyz is the value of the environment variable d. > Lots of little gotchas in pattern matching. > Have fun! > --le > > ----- Original Message ----- > From: "Lorenzo Taylor" > To: "Speakup is a screen review system for Linux." > Sent: Monday, May 02, 2005 4:50 PM > Subject: Re: can't invoke sed properly... > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Someone tell me if there is an easier way, but this worked for me: > > cat my-file | sed "s/red/blue/g" > my-file > > This line replaced red with blue every time it appeared in the file. > > I am using GNU sed version 4.1.4 here. Your mileage may vary. > > Lorenzo > - -- > "We decided that we should evaluate the Microsoft offerings first. Once we > realised what a powerful set of tools they were, it became self-evident this > was > the right way to go down." > > Microsoft: the right way to go down > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.0 (GNU/Linux) > > iD8DBQFCdpKPG9IpekrhBfIRAg8oAJ0WeiXYLHbneHy2fzhSDq79r/23YACglvjU > j3rSTXu9XzKF+eUximAMCB0= > =sm17 > -----END PGP SIGNATURE----- > > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup > > > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup > -- The Moon is Waning Crescent (31% of Full) "Things are in the saddle, and they ride mankind." Ralph Waldo Emerson Visit my download site at http://www.mhcable.com/~chuckh