title: awk to match field between two files and use conditions on match
body: <p>I am trying to look for <code>$2</code> of <code>file1</code> (skipping the header) in <code>$2</code> of <code>file2</code> and if they match and the value in <code>$10</code> is <code>&gt;</code> 30 and <code>$11</code> is <code>&gt;</code> 49, then print the line to a <code>output</code> file.  The below <code>awk</code> has syntax errors in it though <code>shellcheck</code> didn't return any.  Both the input and output are <code>tab-delimited</code>.  I think the below is close, but not sure what is wrong.  Thank you :). </p>
  
  <p><strong>awk</strong></p>
  
  <pre><code> awk -F'\t' -v OFS='\t' 'NR==FNR{A[$2];next}$2 in A
  {if($10 &gt;.5 OFS $11 &gt; 49)
  print ; next
  ' file1 file2
  awk: cmd. line:2: {if($10 &gt;.5 OFS $11 &gt; 49)
  awk: cmd. line:2:                   ^ syntax error
  awk: cmd. line:3: print ; next
  awk: cmd. line:3:             ^ unexpected newline or end of string
  </code></pre>
  
  <p><strong>file1</strong></p>
  
  <pre><code>Missing in IDP but found in Reference:
  2   166848646   G   A   exonic  SCN1A   68  13  16;20   0;0 17;15   0;0 0;0 0;0     c.[5139C&gt;T]+[=] 52.94
  </code></pre>
  
  <p><strong>file2</strong></p>
  
  <pre><code>chr2    166245425   SCN2A   AMPL5155065355  SNP Het C/T C   T   54  100   50    23  27
  chr2    166848646   SCN1A   AMPL1543060606  SNP Het        G/A   G  A   52.9411764706   100 68  32  36
  </code></pre>
  
  <p><strong>desired output</strong></p>
  
  <pre><code>2   166848646   G   A   exonic  SCN1A   68  13  16;20   0;0 17;15   0;0 0;0 0;0     c.[5139C&gt;T]+[=] 52.94
  </code></pre>
  
  <p>edit with new <code>awk</code></p>
  
  <pre><code>awk -F'\t' -v OFS='\t' 'NR==FNR{A[$2];next}$2 in A {
  if($10 &gt;.5 OFS $11 &gt; 49) &gt;&gt;&gt; if($10 &gt;.5 &amp;&amp; $11 &gt; 49)
  print }
  ' file1 file2 &gt; out
  awk: cmd. line:2: if($10 &gt;.5 OFS $11 &gt; 49) &gt;&gt;&gt; if($10 &gt;.5 &amp;&amp; $11 &gt; 49)
  awk: cmd. line:2:                    ^ syntax error
  </code></pre>