title: awk to update field based on if statements except if keyword is in field
body: <p>The <code>awk</code> below works great for <code>input1</code> (when all the required field are present and have values). The <code>Exception</code> fied is updated according to the <code>if</code> statements in the <code>awk</code>.
  It does not for <code>input2</code> or <code>input3</code> (where all the required fields are present but the values are not expected).  The only two fields that can not have a numerical value in them are <code>Barcode2</code> and <code>Barcode3</code>. Most of the time they will, but when they are not present the word<code>missing</code> is the value. My question is when either of these two fields or one of them is <code>missing</code> then that field can be be skipped or not used in the <code>if</code> statements. I am not sure how or where to do that. Thank you :).</p>
  
  <p><strong>input</strong> <code>tab-delimited</code> ---Barcode2 and Barcode3 are "missing"</p>
  
  <pre><code>Barcode1    Barcode2    Barcode3    NoBarcode   Exception
  38774136    missing     missing     0.89
  </code></pre>
  
  <p><strong>script</strong></p>
  
  <pre><code>awk '
  BEGIN { # Set input and output field separator:
      FS = OFS = "\t"
  }
  
  NR == 1 {# Search line 1 of file
      # Create array to tranlate needed field headers to field numbers:
      for(i = 1; i &lt;= NF; i++) {
          f[$i] = i
      }
      next
  }
  
  {
      if($f["Barcode1"] &lt; 20000000 ||
         $f["Barcode2"] &lt; 2000000 ||
         $f["Barcode3"] &lt; 2000000) {
          $f["Exception"] = "Failure due to low barcode reads"
      }
      else {
          $f["Exception"] = "Pass"
      }
      print
  }
  ' input
  </code></pre>
  
  <p><strong>current output for input</strong> <code>tab-delimited</code> should be Pass in Exception as the missing fields are not used</p>
  
  <pre><code>Barcode1    Barcode2    Barcode3    NoBarcode   Exception
  38774136    missing     missing     0.89     Failure due to low barcode reads
  </code></pre>
  
  <p><strong>desired output for input</strong> <code>tab-delimited</code> should be Pass in Exception as the missing fields are not used</p>
  
  <pre><code>Barcode1    Barcode2    Barcode3    NoBarcode   Exception
  38774136    missing     missing     0.89        Pass
  </code></pre>