Below Bash script will give the output count of Numbers, Vowels, and Consonants
#!/bin/sh
echo -n "Enter a line of text: "
read string
numCount=$(echo $string | grep -o "[0-9]" | wc -l)
vowCount=$(echo $string | grep -o -i "[aeiou]" | wc -l)
consCount=$(echo $string | grep -o -i "[bcdfghjklmnpqrstvwxyz]" | wc -l)
echo "Count of vowels $vowCount, $consCount consonants and $numCount numbers in it."
No comments:
Post a Comment