There are probably many ways to do it, but here is one:
Code:
cat file.txt | tr '[:space:]' "\n" | sort | uniq -c |sort -n -r |head -n 1 | awk '{print $2}'
Meaning:
- cat file.txt
- convert all whitespace to newlines
- sort it
- check unique lines, and add the word count first
- sort by word count (numerical) reverse
- only use the first line
- print second word (skip the count)