title: How to substitute a list of patterns with a different one?
body: <p>I try to change in a file some word by others using <code>sed</code> or <code>awk</code>.</p>
  
  <p>I have 1 <code>fileA</code> like this:  </p>
  
  <pre><code>((A,(B,(C,D))),(E));  
  ((A,B),C),D),(E));  
  </code></pre>
  
  <p>and a second <code>fileB</code> with the patterns to change:  </p>
  
  <pre><code>A (foo,bar,foox,barn,foon) 
  B (cat,dog,sheep,abc)  
  C (cadd,dget,vdhfu,dssu,dfhty,dueit)  
  D (cdfte,shdgt,cdht,ddht,ddh)  
  E (cdc,addge) 
  </code></pre>
  
  <p>I want to substitute in my <code>fileA</code> the values <code>A</code>, <code>B</code>, <code>C</code>, <code>D</code>, and <code>E</code> by the one in the pattern file.</p>
  
  <hr>
  
  <p><strong>My attempt:</strong></p>
  
  <pre><code>while read n k; do sed -i.bak "s/$k/$n/g" fileA; done &lt; fileB
  </code></pre>