title: Command in Unix to count number of occurrences of a specific word
body: <p>I want to search Exact word pattern in Unix,</p>
  
  <p>Example : Log.txt file contains following text :</p>
  
  <pre><code>aaa         (only this 'aaa' pattern shhold be counted)
  bbb
  cccaaa   ---&gt; this should not be counted in grep output
  ccc_aaa   --&gt; this should not be counted in grep output
  ccc-aaa   --&gt; this should not be counted in grep output
  ccc.aaa   ---&gt; this should not be counted in grep output
  </code></pre>
  
  <p>I am using following code-</p>
  
  <pre><code>count=$?
  count=$(grep -c -w aaa $ZZZ\Log.txt)
  </code></pre>
  
  <p>Here output should be ==> 1 but i m getting 4 as output, I think, something is missing So, can any one help me for the this please?</p>