Problem in sed.

Hi All!
I am trying to use shell variables in a sed statement, but facing an error.I used the double quotes instead if single quotes in the sed statement.

[root@catinfo conf]# sed -i -e "s/password/$decoded/g;" $CATALINA_HOME/conf/server.xml
sed: -e expression #1, char 11: unterminated `s' command
[root@catinfo conf]# 

Any ideas where I would be going wrong.

?

echo $decoded

decoded variable has the following value "0716373777f62746"

Try

sed -i -e 's/password/'${decoded}'/g;' ...

Your command works with double quotes..!

I tried your command and it gave the following error:

[root@catinfo conf]# sed -i -e 's/password/'${decoded}'/g;'server.xml
sed: -e expression #1, char 11: unterminated `s' command

But this command works excellent.

sed -i -e "s/password/'${decoded}'/g;" server.xml

Thanks a lot Zaxxon for the command!!

sed is strange...:slight_smile:

But this command now is not working...

sed -i -e "s/'${encoded}/'${decoded}'/g;" server.xml
 
sed -i -e "s/'${decoded}'/'${encoded}'/g;" server.xml