a='hello world
hello world
hello world
hello world
hello world ad a a t t hello'
n=0
> result.txt
for word in $a
do
wcount=$(echo $a| grep -o $word | wc -l)
echo "$word : $wcount" >> result.txt
done
cat result.txt | uniq
a='hello world
hello world
hello world
hello world
hello world ad a a t t hello'
n=0
> result.txt
for word in $a
do
wcount=$(echo $a| grep -o $word | wc -l)
echo "$word : $wcount" >> result.txt
done
cat result.txt | uniq