Sed and Bash; unterminated 's' command

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: BoBB
Date:  
Subject: Sed and Bash; unterminated 's' command
SEDRULES="\"s|^foobar[[:blank:]]|foo bar|p;p\""

On Wed, Mar 19, 2003 at 08:01:20AM -0700, Liberty Young wrote:
>
> So, the following command works from the command prompt:
>
>
> sed -ne "s|^foobar[[:blank:]]|foo bar|p;p" processed_file
>
> Basically, replace foobar followed by a whitespace with foo bar
>
> Now, i'm trying to execute the same command in a bash script:
>
> #!/bin/bash
>
> sedrules="s|^foobar[[:blank:]]|foo bar|p;p"
> file=processed_file
>
> sed -ne $sedrules $file
>
> #done
>
> which errors out with: sed -e expression #1, char 27: unterminated `s'
> command
>
> I've googled and found out it has to do with bash and the quotes. Doing
> the same command at the command prompt, but without placing quotes
> around the expression, gives me the same error. But
> sedrules="'s/foobar//p'" doesn't work either. It gives me a sed error of
> unknown command
>
> Anybody come across this before and have any suggestions? Google pointed
> me in the right direction, but with no solutions.
>
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>


--
/* BoBB
* AIM: Jodokast49 ICQ: 151495596
* Jabber:
* http://knightsofchaos.com/~BoBB/new/
*/