title: awk "if" statement
body: <p>I have a file</p>
  
  <pre><code>foo
  --
  bar
  </code></pre>
  
  <p>I only want the lines above the separator. I've struggled with this for too long and tried a number of variants. My one liner is:</p>
  
  <pre><code>echo -e "foo\n-- \nbar" | gawk -v x=0 -- '/^--\ / { x++ } ; IF (x==0) {print} '
  </code></pre>
  
  <p>This should print only "foo" but I get the whole file output. If I change to print x I get</p>
  
  <pre><code>0
  1
  1
  </code></pre>
  
  <p>I can't seem to make make awk conditionally print a line based on the value of x. I know I am missing something simple.</p>