Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site luke.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!oliveb!bene!luke!itkin
From: itkin@luke.UUCP (Steven List)
Newsgroups: net.unix
Subject: Re: sed question
Message-ID: <337@luke.UUCP>
Date: Tue, 1-Oct-85 15:20:35 EDT
Article-I.D.: luke.337
Posted: Tue Oct  1 15:20:35 1985
Date-Received: Thu, 3-Oct-85 06:25:50 EDT
References: <1492@uwmacc.UUCP>
Reply-To: itkin@luke.UUCP (Steven List)
Distribution: net
Organization: Benetics Corp, Mt.View, CA
Lines: 39
Summary: 

In article <1492@uwmacc.UUCP> jwp@uwmacc.UUCP (Jeffrey W Percival) writes:
>sed(1) allows you to give the script on the command line like this:
>
>	sed -e 'script' file1 > file2
>
>Some of the sed commands, like a\ and i\ seem to need additional
>lines of input.  I know that if I use the "-f sedfile" option I
>can stash the commands in a file, but is there a way I can use
>"append" and "insert" with the -e option?

Yep.  First, use the Bourne shell. Then, type the command exactly as
it would appear in a sed command file.  The example I tried (so I
wouldn't sound like an idiot when I posted this) is:

% sh
$ echo hello | sed -e 'a\
there\
chum'
hello
there
chum

Pretty simple, huh?  Apparently the single quote escapes the backslash
escape so that sed sees it just as typed.  This same kind of thing holds
true for commands like echo:

$ echo "This is a multi-line
output example from echo"
This is a multi-line
output example from echo

This lets you create whole screenfulls of output with one invocation of
the echo command.
-- 
***
*  Steven List @ Benetics Corporation, Mt. View, CA
*  Just part of the stock at "Uncle Bene's Farm"
*  {cdp,greipa,idi,oliveb,sun,tolerant}!bene!luke!itkin
***