Monday 20 July 2020

Shell script to count the number of lines in a file that do not contain vowels.


PROGRAM
echo "Enter a filename"
read file
grep -v '^$' $file > gfl
lc=`grep -i -v -c [aeiou] gfl`
echo "Number of lines that do not contain any   vowels are: $lc"


OUTPUT
Enter a filename
fibt
Number of lines that do not contain any   vowels are: 0

Enter a filename
file3
Number of lines that do not contain any   vowels are: 3

No comments:

Post a Comment