title: BEGIN and END causing syntax error in gawk
body: <p><code>BEGIN</code> and <code>END</code> are causing syntax errors in my pretty simple script.</p>
  
  <p>The general outline of the script is:</p>
  
  <pre><code>args=("$0")
  gawk -v var=0 '{
   *do stuff based on input file
   *stuff gets assigned to var
   *END{ print var}
  }' ${args[0]}
  </code></pre>
  
  <p>I get the following error, and I have no idea why:</p>
  
  <pre><code>gawk: cmd. line:x:    END { ... }
  gawk: cmd. line:x:    ^ syntax error
  </code></pre>
  
  <p>EDIT:
  So Adam Liss was right!  I had an error with my curly braces.</p>
  
  <p>What I was essentially doing was gawk '{script END{stuff}}' when I should've been doing gawk'{script}END{stuff}'</p>
  
  <p>Thanks Adam!</p>