#!/usr/bin/bash
echo "Please enter a sentence"
read sentence
for word in $(echo $sentence|xargs -n 1 |sort -u )
do
#occurance=$(echo $sentence | grep -i -o "$word" | wc -w)
echo -e "$word-$(echo $sentence | grep -i -o "$word" | wc -w)"
done
Showing posts with label Find the number of repeatition of each word in a file using bash script without using array. Show all posts
Showing posts with label Find the number of repeatition of each word in a file using bash script without using array. Show all posts
Wednesday, December 21, 2022
Find the number of repeatition of each word in a file using bash script without using array
Subscribe to:
Posts (Atom)