How to reference a variable within sed?

Hi all,

How can I use sed to perform a substitution if the string that I'm going to substitute is stored in a variable:

Let's say:

sed 's/abcdefg/good'

VS

tmp="abcdefg"
sed 's/$tmp/good'

The second case doesn't work. Guess it's due to the single quotes on the outside. How can I get sed to reference the value store in variable tmp, rather than the string "$tmp"?

Thanks a bunch!

Replace the single quotes with double quotes. Single quotes prevent variable expansion.

tmp="abcdefg"
sed "s/${tmp}/good"