sed to variable bash code example
Example 1: sed with variables in shell script
Use double quotes for the sed expression.
sed "s/$replace_string/$replace_with/"`
Example 2: passing bash variable to sed
rr=abcd # in shell
sed -i "s/aaa/$rr/g" file.dat
# -i will update thefile,