I need to replace a multiple strings in file ( in multiple files).
I am using perl code as ..
if [[ "$ORACLE_HOME" = "/opt/product/11.2.0/racdb" || "$ORACLE_HOME" = "/opt/crs/gridsw/11202" ]];then
I need to replace as
if [[ "$ORACLE_HOME" = "/opt/product/11.2.0/*" || "$ORACLE_HOME" = "/opt/crs/gridsw/11202" ]];then
$PERL -pi -w -e 's/"\/racdb"/"\/*"/g;' /tmp/1.sh
no error ..but, it's not working.. what am I missing here .....
Try:
perl -pi -w -e 's~/opt/product/11\.2\.0/racdb~/opt/product/11\.2\.0/\*~' /tmp/1.sh
Thanks for your help.
One more thing ... is there a way to add logic to remove double quotes , to same logic ...
tr/"//d;
Thanks
The previous command was for replacing the path, if you want to replace double quotes with nothing, then I suggest you use a separate command.
perl -pi -w -e 's/\"//g' /tmp/1.sh
Please note that will remove all double quotes, and not just the double quotes of the paths!
I was totally wrong ... tried diff options ...
here is the string ....
if [[ "$ORACLE_HOME" = "/opt/product/11.2.0/racdb" || "$ORACLE_HOME" = "/opt/crs/gsw/11202" ]]; then
I want to change to
if [[ $ORACLE_HOME = /opt/product/11.2.0/* || $ORACLE_HOME = /opt/crs/gsw/* ]]; then
perl -pi -w -e 's~/opt/product/11\.2\.0/racdb~/opt/product/11\.2\.0/\*~g; s/\"//g' /tmp/1.sh