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