title: Replace SYMBOL in file with SYMBOL in another file based on matching string
body: <p>I am not the best scripter and have run into a issue which you might be able to guide me on.
  I have two files. </p>
  
  <p>(1) SYMBOL.txt (where 1st and 2nd column represent NAME and ID)</p>
  
  <pre><code>"UBA6"  "A0AVT1"
  "NBAS"  "A2RRP1"
  "GSAP"  "A4D1B5"
  "GRID2IP"   "A4D2P6"
  "TRAPPC13"  "A5PLN9"
  </code></pre>
  
  <p>(2) PAIR.txt (1st and 2nd column represent IDs)</p>
  
  <pre><code>A0AVT1  P62988
  P06400  Q14186
  Q14186  P28749
  Q6NUQ1  A2RRP1
  O43264  A2RRP1
  </code></pre>
  
  <p>I need to match <code>SYMBOL.txt</code> with <code>PAIR.txt</code> and substitute the <code>IDs</code> in <code>PAIR.txt</code> with NAMES from <code>SYMBOL.txt</code>.</p>
  
  <p>(1) I have written a simple awk script that solves the purpose, but I <strong>also</strong> need to replace the <code>IDS</code> with <code>NA</code>that are not being matched at all (Actually I was not able to do that).</p>
  
  <p>(2) I am getting the input file <code>PAIR.txt</code> modified as output, but I need a separate output file (say <code>LL</code> in this case).</p>
  
  <p>The script I have written:</p>
  
  <pre><code>awk '{print $2 $1}' SYMBOL.txt \
      | sed 's/^/sed/g' \
      | sed 's/\""/\//g' \
      | sed 's/\"/\//g' \
      | sed 's/^sed/sed -i \"s/g' \
      | sed 's/$/g"/g' \
      | sed 's/$/ PAIR.txt/g' \
      | sh &gt;LL
  </code></pre>
  
  <p>The sample output I need:</p>
  
  <pre><code>UBA6 NA
  NA NA
  NA NA
  NA NBAS
  </code></pre>
  
  <p>Any Suggestions Please.</p>