Print number of words:
wc -w <filename>
cat <filename> \ | gawk '{for (i=1;i<=NF;i++) print $i}' \ | sort \ | uniq -c \ | sort -rn \ | less
Print number of words:
Print words with counts in decreasing order: There are optimizations to be made, but that would be my go to solution in the first instance.