title: Word Count using AWK
body: <p>I have file like below :</p>
  
  <p>this is a sample file
  this file will be used for testing</p>
  
  <pre><code>this is a sample file
  this file will be used for testing
  </code></pre>
  
  <p>I want to count the words using AWK.</p>
  
  <p>the expected output is </p>
  
  <pre><code>this 2
  is 1
  a 1
  sample 1
  file 2
  will 1
  be 1
  used 1
  for 1
  </code></pre>
  
  <p>the below AWK I have written but getting some errors</p>
  
  <pre><code>cat anyfile.txt|awk -F" "'{for(i=1;i&lt;=NF;i++) a[$i]++} END {for(k in a) print k,a[k]}'
  </code></pre>