Sed and Bash; unterminated 's' command

BoBB plug-discuss@lists.plug.phoenix.az.us
Wed, 19 Mar 2003 08:57:38 -0700


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 - PLUG-discuss@lists.plug.phoenix.az.us
> 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: BoBB@jabber.com
 *  http://knightsofchaos.com/~BoBB/new/
 */