title: Shell Script to Count the Occurrence of a Word in a file
body: <p>Lets take the below content as an example</p>
  
  <pre><code>    This file is a test file 
      this file is used to count the word 'file' in this test file
      there are multiple occurrences of word file in some lines in this test file
  </code></pre>
  
  <p>I want to count the word 'file' in the above content.</p>
  
  <p>I'm using the below shell command </p>
  
  <pre><code>   cat $filename |  sed "s/_/new/g" | sed "s/$word/_/g" | tr -c -d _ |wc -c
  </code></pre>
  
  <p>Is that ok or any better ideas ..?</p>