f



sed: -e expression #1, char 54: unterminated `s' command

I have the following statement in my script

sed -e 's/\#Usage/'$var'/g' Test

And assume that $var has a huge amount of text say 1000 chars. I get
the following error when i run the script

sed: -e expression #1, char 54: unterminated `s' command

0
SamG
4/19/2007 6:23:29 PM
comp.unix.shell 15484 articles. 2 followers. Post Follow

2 Replies
2770 Views

Similar Articles

[PageSpeed] 12

SamG wrote:
> I have the following statement in my script
> 
> sed -e 's/\#Usage/'$var'/g' Test
> 
> And assume that $var has a huge amount of text say 1000 chars. I get
> the following error when i run the script
> 
> sed: -e expression #1, char 54: unterminated `s' command
> 

At least have $var quoted:

sed -e 's/\#Usage/'"$var"'/g' Test

And $var must not contain any ; or / or Newline character.



-- 
Michael Tosch @ hp : com
0
Michael
4/19/2007 6:34:11 PM
2007-04-19, 20:34(+02), Michael Tosch:
> SamG wrote:
>> I have the following statement in my script
>> 
>> sed -e 's/\#Usage/'$var'/g' Test
>> 
>> And assume that $var has a huge amount of text say 1000 chars. I get
>> the following error when i run the script
>> 
>> sed: -e expression #1, char 54: unterminated `s' command
>> 
>
> At least have $var quoted:
>
> sed -e 's/\#Usage/'"$var"'/g' Test
>
> And $var must not contain any ; or / or Newline character.
[...]

; wouldn't be a problem. &, / and \ would.


-- 
St�phane
0
Stephane
4/19/2007 7:51:30 PM
Reply: