title: In linux bourne shell: How to count the occurrences of a specific word in a file
body: <p>By <em>word</em>, I mean any whitespace-delimited string.</p>
  
  <p>Suppose the file <code>test.txt</code> has the following words delimited by spaces:</p>
  
  <pre><code>hello hello hello hell osd
  hello
  hello 
  hello
  hellojames beroo helloooohellool axnber hello
  way
  how 
  </code></pre>
  
  <p>I want to count the number of times the word <em>hello</em> appears in each line.</p>
  
  <p>I used the command <code>awk -F "hello" '{print NF-1}' test.txt</code> to show the number of occurrences of the word <em>hello</em> in each line:</p>
  
  <pre><code>3
  1
  1
  1
  4
  0
  0
  </code></pre>
  
  <p>So it find a total of 3+1+1+1+4 = 10 occurrences.</p>
  
  <p>The problem is the on fourth line: <em>hello</em> only occurs 1 time as a separate word; words such as <em>hellojames</em> and <em>helloooohellool</em> should not be counted because <em>hello</em> is not delimited by whitespace.</p>
  
  <p>So I want it to find 7 occurrences of <em>hello</em> as a separate word.</p>
  
  <p>Can you help me write a command that returns the correct total of 7 times?</p>