can't invoke sed properly...

Laura Eaves leaves1 at carolina.rr.com
Mon May 2 16:41:09 EDT 2005


Hi Ned --
Well you should probably use

sed -e pattern filename >outfile

But beware of sed.
I once was chasing down an obscure bug in a very large script and between me 
and another person we found that a call to sed was implicitly truncating a 
long line to a built in maximum.
The resulting behavior of the script was quite confusing to say the least.
Sed will give no error message about this, and for must apps you won't run 
into it, but be aware that sed will truncate lines it can't load into its 
buffer.

Now as for your pattern, I believe you can delete the 1,$ as sed should 
cycle through the lines as it is and pass the updated liine to output.
So your line should be:

sed -e 's/red/blue/g' filename >outfile

HTH
--le


----- Original Message ----- 
From: "Ned" <ngranic at cox.net>
To: "Speakup is a screen review system for Linux." <speakup at braille.uwo.ca>
Sent: Monday, May 02, 2005 4:23 PM
Subject: can't invoke sed properly...


Hi all,
I have problemof invoking the sed text editor properly.
How, let's say, would I invoke sed in order to make a substitution in all 
lines of my_file:
sed :1,$ s/red/blue/g my_file
I am writing a bash script and need to test each line outside it first to 
make sure it works.


Many thanks in advance!
Ned
_______________________________________________
Speakup mailing list
Speakup at braille.uwo.ca
http://speech.braille.uwo.ca/mailman/listinfo/speakup 





More information about the Speakup mailing list