linux sed set and use variable code example
Example: sed replace with variable
Use double quotes to make the shell expand variables while preserving whitespace:
sed -i "s/$var1/ZZ/g" "$file"
Use double quotes to make the shell expand variables while preserving whitespace:
sed -i "s/$var1/ZZ/g" "$file"