proper syntax for the s command along to the addressing in sed
<p>I want to issue this command from the bash script<br>
<code>sed -e $beginning,$s/pattern/$variable/ file</code></p>

<p>but any possible combination of quotes gives me an error, only one that works:<br>
<code>sed -e "$beginning,$"'s/pattern/$variable/' file</code></p>

<p>also not good, because it do not dereferences the variable.</p>

<p>Does my approach can be implemented with sed?</p>