It doesn't work the way you think, but it does work
Archive of posts tagged shell
Using shell variables in sed
How to safely use shell variables in sed
Find files containing specific words
Print the names of the files that contain some set of words
Debugging sed programs
How to debug sed programs