It doesn't work the way you think, but it does work
Archive of posts filed under the sed category.
Using shell variables in sed
How to safely use shell variables in sed
Debugging sed programs
How to debug sed programs
Reverse lines in sed
Simple sed code to reverse a line