Write a shell script to find out the unique words in a file and also count the occurrence of each of these words. We can say that the file under consideration contains many lines, and each line has multiple words.
sed -e 's/ /\n/g' filename | grep -v '^$' | sort | uniq -c | sort -n