GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Operating System  >  Shell Scripting
Go To First  |  Previous Question  |  Next Question 
 Shell Scripting  |  Question 37 of 44    Print  
How do you search the string for vowel's occurrence and number of occurrences of each vowel

  
Total Answers and Comments: 4 Last Update: July 19, 2008     Asked by: Nidhi2177 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: svaidehi
 
Even the below command can be used:

grep -io [aeiou] filename | wc -w

Above answer was rated as good by the following members:
jrgalaura
October 25, 2007 05:45:59   #1  
anuj.mmmec Member Since: October 2007   Contribution: 2    

RE: How do you search the string for vowel's occurrenc...
for a=cat filename |tr -d 'eioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep a|wc -m
for e=cat filename |tr -d 'aioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep e|wc -m
for i=cat filename |tr -d 'aeoubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep i|wc -m
for o=cat filename |tr -d 'aeiubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep o|wc -m
for u=cat filename |tr -d 'aeiobcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep u|wc -m


it will give the no of time that vowel has been occured


for searching the string
cat filename | grep 'aeiou'

 
Is this answer useful? Yes | No
October 25, 2007 05:57:37   #2  
anuj.mmmec Member Since: October 2007   Contribution: 2    

RE: How do you search the string for vowel's occurrenc...

hey please also add           tr -d '        before wc -m

FE : cat filename|tr -d 'eioubcdfghjklmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()~`!@#$%^&*"()_+{}|:"<>?,./;][=-/n ' |grep a|tr -d '|wc -m


for counting the vowels


 
Is this answer useful? Yes | No
April 10, 2008 03:22:01   #3  
svaidehi Member Since: April 2008   Contribution: 1    

RE: How do you search the string for vowel's occurrence and number of occurrences of each vowel
Even the below command can be used:

grep -io [aeiou] filename | wc -w

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
July 19, 2008 13:37:57   #4  
anu1985 Member Since: May 2008   Contribution: 11    

RE: How do you search the string for vowel's occurrence and number of occurrences of each vowel
tail -n +2 <file>|head -n 1
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape