title: AWK script to check first line of a file and then print the rest
body: <p>I am trying to write an AWK script to parse a file of the form</p>
  
  <pre><code>&gt; field1 - field2 field3 ...
  lineoftext
  anotherlineoftext
  anotherlineoftext
  </code></pre>
  
  <p>and I am checking using regex if the first line is correct (begins with a > and then has something after it) and then print all the other lines. This is the script I wrote but it only verifies that the file is in a correct format and then doesn't print anything.</p>
  
  <pre><code>#!/bin/bash
  # FASTA parser
  
  awk ' BEGIN { x = 0; }
  { if ($1 !~ /&gt;.*/ &amp;&amp; x == 0)
      { print "Not a FASTA file"; exit; }
    else { x = 1; next; }
    print $0 }
  END { print " - DONE - "; }'
  </code></pre>