title: How to find number of columns in shell script?
body: <p>I am having text file say 01-01-2013.txt and it has contents as below</p>
  
  <pre><code>cat 01-01-2013.txt | cut -d',' -f1-10 | head -6
  </code></pre>
  
  <pre>
  TIMESTAMP,DATE,HOUR_MINUTE,CAWFM,CSQ2,DBCRIS.CA.MSG,DBI.MSBR.INCOMING.Q,DBI.MSBR.INCOMING.Q.ERROR,DBT.CA.RECEIVE.CUST,DBT.CA.RECEIVE.CUST.ERROR
  20130101000019,01.01.2013,00:00,0,0,0,0,0,6893,31
  20130101000133,01.01.2013,00:01,0,0,0,0,0,6858,31
  20130101000246,01.01.2013,00:02,0,0,0,0,0,6661,31
  20130101000359,01.01.2013,00:03,0,0,0,0,0,6314,31
  20130101000512,01.01.2013,00:05,0,0,0,0,0,6074,31
  </pre>
  
  <p>When i tried to find number of columns i have used below command and i m not getting the expected result as below. its just returning 1</p>
  
  <pre><code>awk 'BEGIN {IFS=","};END{print NF}' 01-01-2013.txt
  </code></pre>
  
  <p>Result</p>
  
  <p>1</p>
  
  <p>Please help me to find out the total number of columns.</p>