title: Decode HTML entities with SED or AWK
body: <p>I am working on Mac trying to decode a simple line like</p>
  
  <pre><code>$var='doc_input'
  $textToChange='&amp;lt;div&amp;gt; &amp;lt;doc_input/&amp;gt; &amp;lt/div&amp;gt;' 
  echo $textToChange | sed -e s=\&amp;lt\;$var\/\&amp;gt\;=\&lt;$var\/\&gt;=g
  </code></pre>
  
  <p>to </p>
  
  <pre><code>&amp;lt;div&amp;gt; &lt;doc_input/&gt; &amp;lt;/div&amp;gt;
  </code></pre>
  
  <p>it will work. The result has to be mixed up with encoded and decoded entities.</p>
  
  <p>But if I try to write it in a file it will not work. The file a.txt contains the text.</p>
  
  <pre><code>sed -e s=\&amp;lt\;$var\/\&amp;gt\;=\&lt;$var\/\&gt;=g a.txt &gt; c.txt
  </code></pre>
  
  <p>The output is the same as the input.
  Please how do I have to proceed?</p>