nua7
July 15, 2008, 3:52am
1
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.
nua7
July 15, 2008, 5:12am
3
decoded variable has the following value "0716373777f62746"
zaxxon
July 15, 2008, 5:17am
4
Try
sed -i -e 's/password/'${decoded}'/g;' ...
nua7
July 15, 2008, 5:23am
5
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...
nua7
July 15, 2008, 5:34am
6
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