anuj.mmmec Profile Answers by anuj.mmmec Oct 25th, 2007 for a=cat filename |tr -d 'eioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep a|wc -m for e=cat filename |tr -d 'aioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep e|wc -mfor i=cat filename |tr -d 'aeoubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep i|wc -mfor o=cat filename |tr -d 'aeiubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep o|wc -mfor u=cat filename |tr -d 'aeiobcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep u|wc -mit will give the no of time that vowel has been occuredfor searching the string cat filename | grep 'aeiou'
anuj.mmmec Profile Answers by anuj.mmmec Oct 25th, 2007 hey please also add tr -d ' before wc -mFE : cat filename|tr -d 'eioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep a|tr -d '|wc -mfor counting the vowels
svaidehi Profile Answers by svaidehi Apr 10th, 2008 Even the below command can be used:grep -io [aeiou] filename | wc -w
Rohit_Ash Profile Answers by Rohit_Ash Jun 4th, 2009 For 'a'cat file_name | tr -cd 'a' | wc -mFor 'e'cat file_name | tr -cd 'e' | wc -mFor 'i'cat file_name | tr -cd 'i' | wc -mFor 'o'cat file_name | tr -cd 'o' | wc -mFor 'u'cat file_name | tr -cd 'u' | wc -m
rana4bhu Profile Answers by rana4bhu Jun 4th, 2009 I am giving the 3 ways to solve this problem..1) grep -io "[aeiouAEIOU]" filename | sort | uniq -c2) cat filename | sed 's/[a-zA-Z]/&n/g' | sed 's/^ //' | grep "[aeiouAEIOU]" | sort | uniq -c 3) cat filename | fold -1 | sort | sed -n '/^[aeiouAEIOU]/p' | uniq -cThanks All codes are tested and working....
anil Sep 21st, 2017 upendram@upendrams-host:~$ echo $pattern | grep -o . | while read chars; do cnt=`echo "${str}" | grep -o "${chars}" | wc -l`; if [[ $cnt -gt 0 ]]; then echo "$chars -- occurs --- $cnt times" >> string_counts; fi; done upendram@upendrams-host:~$ cat string_counts e -- occurs --- 3 times i -- occurs --- 3 times o -- occurs --- 1 times u -- occurs --- 1 times upendram@upendrams-host:~$ echo $str Thuis is some text file upendram@upendrams-host:~$ echo $pattern aAeEiIoOuU
How do you search the string for vowel's occurrence and number of occurrences of each vowel
Profile Answers by Nidhi2177 Questions by Nidhi2177
Questions by Nidhi2177