[net.unix-wizards] How do you get 'sed' to append??

lsk (02/14/83)

According to the manual to append in sed, one does a

a\
text

However, sed replies, comman garbled: atext

So, how does one get sed to append??


Larry S. Kaufman
 Western Electric
 Network Software Center
 Lisle
 Illinois

mjb (02/15/83)

I just love it when people post problems they have with their respective
systems, like "hey, why doesn't a\ work in sed", without providing enough
info on how to reconstruct the problem. The puzzle then becomes "How did
he get *that* result?" Anyhow since the a\ works fine when the sed script
was a file, I assumed a shell was munching the newline. The following little
script shows some interesting results I discovered via brute force search.

Here I am in csh; "sedfile" contains the single line: "original file"

% sed a\
text sedfile
command garbled: a	(close, no cigar)
% sed 'a\
text' sedfile
command garbled: a	(At least it's consistent!)

Now I'm in regular shell

$ sed 'a\
> text' sedfile
original file
text			(Gee, that worked!)
$ sed a\
> text sedfile
command garbled: atext	(AHA! that's how he did it!)

Mike Braca, ..!decvax!brunix!mjb, mjb.brown@udel-relay