Check out example codes for "write a bash script that accepts a text file as argument and calculates number of occurrences of each words in it and return them as key value pairs". It will help you in understanding the concepts better.
Code Example 1
file=/home/stefan/ooxml1.txt for word in $(sed 's/[^A-Za-z]/ /g' $file | tr " " "\n" | sort -u) do echo -n "$word " grep -c $word $file done | sort -k2 -n
Learn ReactJs, React Native from akashmittal.com