title: awk to find number of columns for each line and exit if more than required
body: <p>I'm trying to read a file line by line and check to see if the current line contains more than one column. if it contains more than one, I want the script to abort.</p>
  
  <p>I have a file called test and it contains the following...</p>
  
  <pre><code>ME
  TEST
  HELLO
  WORLD
  BOO,HOO
  BYE BYE
  </code></pre>
  
  <p>I've found using awk that I can get the count of columns by using the following...</p>
  
  <pre><code>awk -F',' '{print NF}' test
  </code></pre>
  
  <p>and this returns...</p>
  
  <pre><code>1
  1
  1
  1
  2
  1
  </code></pre>
  
  <p>Is there a way to have the script exit after the '2' is found and print an Error stating $1 (in this case BOO,HOO) contains two columns?</p>