I have encrypted passwords specific to each environment. It has some special characters. Below is one sample from development environment (which has forward slash)
$$Param_INFA_USER=USR_DF
$$Param_INFA_PASS=1OFR6pSbNq/yvLtpxHbC9E9KvloTj5tRGpzr9dCMD7E=
v_prst_pwd=`grep -i "\\$\\$Param_INFA_PASS" param_file.parm` | tr -d ' '
v_lbl_pwd=`grep -i "\\$\\$Param_INFA_PASS" param_file.parm | cut -d '=' -f1`
sed -i 's/'$v_prst_pwd'/'$v_lbl_pwd'='$envspfc_pwd'/g' param_file.parm
sed -i s/$$Param_INFA_PASS=**1OFR6pSbNq/yvLtpxHbC9E9KvloTj5tRGpzr9dCMD7E=**/$$Param_INFA_PASS=ABC/g param_file.parm
I am trying to replace passwords and got below issue.
sed: -e expression #1, char 74: unknown option to `s'
How to escape special characters when replacing a string which is a variable (not aware of position of special characters).
$$Param_INFA_USER=USR_DF
do? – Chris Davies Jul 02 '18 at 16:18$$Param_INFA_PASS
, really with double dollar signs? – AlexP Jul 02 '18 at 16:36