Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.7.0.8 $; site uicsl
Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uicsl!solomon
From: solomon@uicsl.UUCP
Newsgroups: net.unix
Subject: Re: sed question
Message-ID: <15200008@uicsl>
Date: Mon, 30-Sep-85 11:08:00 EDT
Article-I.D.: uicsl.15200008
Posted: Mon Sep 30 11:08:00 1985
Date-Received: Wed, 2-Oct-85 09:39:14 EDT
References: <1492@uwmacc.UUCP>
Lines: 24
Nf-ID: #R:uwmacc.UUCP:-149200:uicsl:15200008:000:831
Nf-From: uicsl.UUCP!solomon    Sep 30 10:08:00 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@uiuc.arpa
solomon%uicsl.uucp@uiuc.arpa