You can use "grep" command in different ways to count the occurrence of a word in your text file. Have a look at the following examples:
Suppose you want to search the word "Hello" in the file abc.txt, you can use the following commands:
$cat abc.txt | grep -c Hello
$cat abc.txt | grep Hello | wc -l
If you need to count Hello but not prefixHello or Hellosuffix or prefixHellosuffix, you can use the following commands:
$ cat abc.txt | grep -c '\Hello'
$ cat abc.txt | grep '\Hello' | wc -l