Try this instead of the space. I just had a long fight with sed myself.
edit fix.sh and put in it:
#!/bin/sh
echo "s/^foobar[[:blank:]]/foo bar/p" > edit.lst
sed -f edit.lst processedfile > processedfile.fixed
rm -f edit.lst
Then run it. If I add the ;p I get a different error but the insertion
of the "foo bar" works fine.
Cheers,
Davidm
On Wed, 2003-03-19 at 08:01, 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
--
David IS Mandala
gpg fingerprint 8932 E7EF CCF5 1B8C 1B5C A92E C678 795E 45B2 D952
Phoenix, AZ (480) 460-7545 HP, (602) 741-1363 CP
http://www.them.com/~davidm/