Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!emory!att!cbnewsl!bonnie!rbr From: rbr@bonnie.ATT.COM (4197,ATTT) Newsgroups: comp.unix.shell Subject: Re: sed script to add >'s to quoted text Keywords: sed shell Message-ID: <1991Feb23.160536.15413@cbnewsl.att.com> Date: 23 Feb 91 16:05:36 GMT References: Sender: @cbnewsl.att.com Reply-To: rbr@bonnie.ATT.COM (Bob Rager) Distribution: usa Organization: AT&T Bell Laboratories Lines: 34 In article dblack@pilot.njin.net (David Alan Black) writes: >I am trying to devise a simple shell script to add ">" to the beginning of >every line of a text file containing an article or letter which I wish to >quote in my response. > >Can someone please explain why the following doesn't work (I'll reproduce >the whole session): > >pilot% cat > quote >sed s/^/\>/ -e $1 > $1.quoted >^D >pilot% chmod a+x quote >pilot% quote friend.letter >quote: />/: not found >pilot% sed: Illegal or missing delimiter: s/ > > Mrs. Emma Peel Your problem is that the shell can see the \> which it takes as a literal and redirection. Try this: cat >quote </" $1 >$1.quoted EOD quote letter Note "-e" is not a switch, it is a non-positional command line parameter. An edit script must follow it. Hope this helps. Bob Rager Ain't no place like ${HOME}. Brought to you by Super Global Mega Corp .com