|
|
sed: file sedd line 13: Unknown command: ``-''
Would someone please explain why I get that error message when I run this
script which is in a file and sourced by sed -f scriptfile file ?
When I escape the "-" I get:
sed: file sedd line 13: Unknown command: ``L''
when I escape THAT It tells me that "\" is an unknown command.
I have escaped everything in sight "\" :-)
But what is below is what I *thought* should work.
Am using GNU sed and bash
/^### Priveleged/a\
\
\
:0\
* ^Subject.*er554kk\
* ! ^X-Loop: joe@isp.net\
{\
:0 c\
${DEFAULT}\
\
:0 ha\
| (formail -r -I"X-Loop" \\
-A"X-Loop: joe@isp.net" ; \\
echo " computer-generated response:" ;\\
echo ; \\
echo " Mail Received -- Thank You" ; \\
echo ; \\
echo ; \\
echo ; \\
echo ; \\
) \\
| $SENDMAIL -t\
\
}\
I may still have some hair left when I check back in here :-)
Thank you very much
Alan
--
There's no place like ~
|
|
0
|
|
|
|
Reply
|
Alan
|
7/15/2003 7:42:32 PM |
|
On Tue, 15 Jul 2003 19:42:32 GMT, Alan Connor <xxxxxx@xxxx.xxx> wrote:
> Would someone please explain why I get that error message when I run this
> script which is in a file and sourced by sed -f scriptfile file ?
> When I escape the "-" I get:
> sed: file sedd line 13: Unknown command: ``L''
> when I escape THAT It tells me that "\" is an unknown command.
>
>
>
> I have escaped everything in sight "\" :-)
> But what is below is what I *thought* should work.
>
> Am using GNU sed and bash
>
>
>
>
> /^### Priveleged/a\
> \
> \
>:0\
> * ^Subject.*er554kk\
> * ! ^X-Loop: joe@isp.net\
> {\
>:0 c\
> ${DEFAULT}\
> \
>:0 ha\
>| (formail -r -I"X-Loop" \\
> -A"X-Loop: joe@isp.net" ; \\
> echo " computer-generated response:" ;\\
> echo ; \\
> echo " Mail Received -- Thank You" ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> ) \\
>| $SENDMAIL -t\
> \
> }\
>
>
> I may still have some hair left when I check back in here :-)
>
> Thank you very much
>
> Alan
>
>
The way to do this is with ed:
#!/bin/bash
ed file_to_edit <<EOF
/search_string/a
put all that stuff and escape the backslashes and $ and #
..
w
q
EOF
That's thanks to a fellow named Barry Margolin from an old post
in the archives.
Thanks, Barry
Alan
--
There's no place like ~
|
|
0
|
|
|
|
Reply
|
Alan
|
7/16/2003 12:48:53 AM
|
|
On Tue, 15 Jul 2003 19:42:32 GMT, Alan Connor
<xxxxxx@xxxx.xxx> wrote:
> Would someone please explain why I get that error message when I run this
> script which is in a file and sourced by sed -f scriptfile file ?
> When I escape the "-" I get:
> sed: file sedd line 13: Unknown command: ``L''
> when I escape THAT It tells me that "\" is an unknown command.
>
>
>
> I have escaped everything in sight "\" :-)
> But what is below is what I *thought* should work.
>
> Am using GNU sed and bash
>
The first several lines of the script end with \, then all of a sudden
you switch to \\. The single \ escapes the newline, so that the lines
ending with \ are all seen as one command. When you start using \\,
the newlines are not escaped. I think you need to change \\ to \\\.
>
>
> /^### Priveleged/a\
> \
> \
>:0\
> * ^Subject.*er554kk\
> * ! ^X-Loop: joe@isp.net\
> {\
>:0 c\
> ${DEFAULT}\
> \
>:0 ha\
>| (formail -r -I"X-Loop" \\
> -A"X-Loop: joe@isp.net" ; \\
> echo " computer-generated response:" ;\\
> echo ; \\
> echo " Mail Received -- Thank You" ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> ) \\
>| $SENDMAIL -t\
> \
> }\
>
>
> I may still have some hair left when I check back in here :-)
>
> Thank you very much
>
> Alan
>
>
--
Here I am, fifty-eight, and I still don't know what I want to be when
I grow up.
-- Peter Drucker
|
|
0
|
|
|
|
Reply
|
Bill
|
7/16/2003 12:55:03 PM
|
|
On Wed, 16 Jul 2003 08:55:03 -0400, Bill Marcum <bmarcum@iglou.com> wrote:
> On Tue, 15 Jul 2003 19:42:32 GMT, Alan Connor
>>
> The first several lines of the script end with \, then all of a sudden
> you switch to \\. The single \ escapes the newline, so that the lines
> ending with \ are all seen as one command. When you start using \\,
> the newlines are not escaped. I think you need to change \\ to \\\.
>
Worth a try. Thanks.
>Bill
>--
>Here I am, fifty-eight, and I still don't know what I want to be when
>I grow up.
> -- Peter Drucker
Right on! ^
Alan
--
There's no place like ~
|
|
0
|
|
|
|
Reply
|
Alan
|
7/16/2003 5:38:25 PM
|
|
Alan Connor <xxxxxx@xxxx.xxx> wrote in message news:<IOYQa.102508$Io.8820954@newsread2.prod.itd.earthlink.net>...
> Would someone please explain why I get that error message when I run this
> script which is in a file and sourced by sed -f scriptfile file ?
> When I escape the "-" I get:
> sed: file sedd line 13: Unknown command: ``L''
> when I escape THAT It tells me that "\" is an unknown command.
>
>
>
> I have escaped everything in sight "\" :-)
> But what is below is what I *thought* should work.
>
> Am using GNU sed and bash
>
>
>
>
> /^### Priveleged/a\
> \
> \
> :0\
> * ^Subject.*er554kk\
> * ! ^X-Loop: joe@isp.net\
> {\
> :0 c\
> ${DEFAULT}\
> \
> :0 ha\
> | (formail -r -I"X-Loop" \\
> -A"X-Loop: joe@isp.net" ; \\
> echo " computer-generated response:" ;\\
> echo ; \\
> echo " Mail Received -- Thank You" ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> echo ; \\
> ) \\
> | $SENDMAIL -t\
> \
> }\
>
u r off by just 1 \ in \\
need 1 \ for sed's append command and 2 \ for slipping in a literal \
in the appended text.
|
|
0
|
|
|
|
Reply
|
sharma__r
|
7/16/2003 7:22:35 PM
|
|
On 16 Jul 2003 12:22:35 -0700, rakesh sharma <sharma__r@hotmail.com> wrote:
> Alan Connor <xxxxxx@xxxx.xxx> wrote in message news:<IOYQa.102508$Io.8820954@newsread2.prod.itd.earthlink.net>...
>
>
> u r off by just 1 \ in \\
>
> need 1 \ for sed's append command and 2 \ for slipping in a literal \
> in the appended text.
Thanks a lot, Rakesh.
Alan
--
There's no place like ~
|
|
0
|
|
|
|
Reply
|
Alan
|
7/16/2003 8:24:16 PM
|
|
|
5 Replies
89 Views
(page loaded in 0.107 seconds)
|
|
|
|
|
|
|
|
|