Word Count Frequency

Write A Shell Script to find Word Frequency Of A given File Shell Script: clear l=`cat me.txt | wc -l` echo $l word=0 touch str.txt touch bb.txt for((i=1;i<=$l;i++)) do cat me.txt | head -n $i | tail -n 1 > str.txt w1=`cat str.txt | wc -w` echo $w1 touch aa.txt for((j=1;j<=$w1;j++)) do cut -d" " -f$j str.txt >> aa.txt done cat aa.txt >> bb.txt rm aa.txt done cat bb.txt | sort | uniq -c OUTPUT [admin@localhost ~]$ sh wordfreq.sh 2 am 1 computer 1 department 2 paul 4 i 1 in 1 is 1 kk 1 my 1 name 1 read 1 vit 1 science 8 rakesh

Share:

0 comments