Unable to use sed to replace text with shell variable : <p>For some reason, the answer in the post below doesn't work for me.  Any thoughts?<br>
<a href="https://stackoverflow.com/questions/15230020/how-to-use-sed-to-replace-a-string-in-a-file-with-a-shell-variable">how to use sed to replace a string in a file with a shell variable</a> </p>

<p>I'm running CentOS 6.5</p>

<pre><code>`NEW="new value"
cat myfile.txt | sed -e 's/old/${NEW}' &lt;-- just replaces 'old' with '${NEW}'
cat myfile.txt | sed -e 's/old/$NEW' &lt;-- just replaces 'old' with '$NEW'
cat myfile.txt | sed -e "s/old/${NEW}" &lt;-- gives the error: unknown option to `s'
</code></pre>
