title: Counting NULL and spaces together in a file in UNIX
body: <p>I've to count the number of NULL values in a required field in a file in UNIX and I was using the folowing command</p>
  
  <pre><code>awk -F"|" '$3{NN++;next}
               {N++}
       END { print "Null: " N "   Not Null: " NN }' NULL_test.dat
  </code></pre>
  
  <p>Following is the sample file</p>
  
  <pre><code>cat NULL_test.dat
  a|b|c|d
   |d|00|a
   || |x
  s| ||a
  0||0|0
  1|2|3|4
  </code></pre>
  
  <p>Problem with above code is it consider [0] as NULL while spaces are considered as having values</p>
  
  <pre><code>Expected output was NULL : 2 NOT NULL: 4
  Actual output is NULL : 3 NOT NULL: 3
  </code></pre>