sed question

solomon at uicsl.UUCP solomon at uicsl.UUCP
Tue Oct 1 01:08:00 AEST 1985


All sed commands are supposed to be on one line; therefore multiple line
insertions need to have the newline character escaped by use of the \.
Similarly, the shell assumes that a newline terminates the command, and
needs to have the newline character escaped via \.  Therefore, to use
append and insert with the -e option to sed, one must do something like

% sed -e '10a\\
haha\\
hoho\\
heehee\
' junk > morejunk

so that the shell reads a \, strips it off and ignores the newline character
following it, and thus passes a newline escaped with a \ to sed.  On the line
which inserts heehee, the shell passes an unescaped newline to sed, which
properly terminates the append command.

					Dilip V. Sarwate

....ihnp4!uiucdcs!uicsl!sarwate
....ihnp4!uiucdcs!uicsl!solomon
sarwate%uicsl.uucp at uiuc.arpa
solomon%uicsl.uucp at uiuc.arpa



More information about the Comp.unix mailing list