I would like to replace string in file contains ${user.home} using sed in Linux but I'm unable to do it. I tried below options using sed but failed.
The input file:
<property name="dev.home" value="${user.home}"/>
Tried code to replace ${user.home}
:
sed -i "s/$${user.home}/r_str/g" 1.xml
sed -i "s/${user.home}/r_str/g" 1.xml
sed -i "s/\$\{user\.home\}/r_str/g" 1.xml
Actual:
<property name="dev.home" value="${user.home}"/>
Expected:
<property name="dev.home" value="/dev"/>