mac_g
asked on
shell script : find and replace using sed .. not reflecting when using parameters to sed
===== shell script tt.sh =============
var1="(CMANAGER_NAME = GOOGLE.WORLD))"
echo $var1
var2="(RAW_NAME = dest.com))"
echo $var2
find . -type f -name 2.txt -print0 | xargs -0 sed -i 's@$var1@$var2@g'
========2.txt=================
hello1
(CMANAGER_NAME = GOOGLE.WORLD))
hello2
(RAW_NAME = dest.com))
hello3
================== ERROR MESSAGE
hello3[root@RHEL7 scripts]# sh tt.sh
(CMANAGER_NAME = GOOGLE.WORLD))
(RAW_NAME = dest.com))
sed: -e expression #1, char 16: unterminated `s' command
[root@RHEL7 scripts]#
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just one word .. ..
U save my Day@ simon3270
Please advice for preparing server automation scripts, apart from shell scripting which other scripting will be helpful for unix based env ??
=====================
I have tested below type of strings, that actually is my requirement .. working perfect
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ngerard)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = orcl)))(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = other)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = orcl)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP99)(HOST = other)(PORT = 1521-99)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORCL)))
U save my Day@ simon3270
Please advice for preparing server automation scripts, apart from shell scripting which other scripting will be helpful for unix based env ??
=====================
I have tested below type of strings, that actually is my requirement .. working perfect
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ngerard)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = orcl)))(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = other)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = orcl)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP99)(HOST = other)(PORT = 1521-99)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORCL)))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
can you please advice for the below thread .. am almost done !
https://www.experts-exchange.com/questions/29220540/shell-script-find-and-replace-using-sed-not-reflecting-when-using-parameters-to-sed.html
https://www.experts-exchange.com/questions/29220540/shell-script-find-and-replace-using-sed-not-reflecting-when-using-parameters-to-sed.html
ASKER
problem solved
ASKER