Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site tektools.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!tektools!jerryp
From: jerryp@tektools.UUCP (Jerry Peek)
Newsgroups: net.unix
Subject: Re: sed question
Message-ID: <495@tektools.UUCP>
Date: Mon, 30-Sep-85 11:15:38 EDT
Article-I.D.: tektools.495
Posted: Mon Sep 30 11:15:38 1985
Date-Received: Thu, 3-Oct-85 03:49:52 EDT
References: <1492@uwmacc.UUCP>
Reply-To: jerryp@tektools.UUCP (Jerry Peek)
Distribution: net
Organization: Tektronix, Beaverton OR
Lines: 31
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?

Yes, but the way you do it depends on which shell you're using.
For example, in Bourne or Korn shells, you can do:
	$ sed -e '1a\
	> hi\
	> there' file1 > file2
	$
(the >'s are Bourne-shell secondary prompts).

To avoid "Unmatched '." errors in the C-shell, you have to use extra
backslashes:
	% sed -e '1a\\
	hi\\
	there' file1 > file2
	%
(in this case, csh won't give a secondary prompt).

--Jerry Peek, UNIX Training Instructor, Tektronix, Inc.
US Mail:    MS 74-222, P.O. Box 500, Beaverton, OR 97077
uucp:       {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
CS,ARPAnet: jerryp%tektools@tektronix.csnet
Phone:      503/627-1603