Unix - wordcount
source: http://www.unix.com/nl/unix-dummies-questions-answers/108614-word-count.html and http://www.unix.com/unix-dummies-questions-answers/87375-how-count-occurences-specific-word-file-bash-shell.html
Counting the number of times a word occurs in a file:
tr ' ' '\012' < abc.xml | grep -c result
or
awk '{for (i=1;i<=NF;i++) if ($i == "result")count++} END{print count}' abc.xml
or
tr -s ' ' '\n' < myfile.txt | grep -c 'searchword'