Find the answer to your Linux question:
Results 1 to 5 of 5
hey.! i want to write a command using grep .. so that i can find all the words in my file having exactly 1 vowel. i tried using grep -iw ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    2

    vowels - grep command


    hey.!
    i want to write a command using grep ..
    so that i can find all the words in my file having exactly 1 vowel.
    i tried using grep -iw ".\?[aeiou]\?" k.txt
    but it dosnt' seem to work.
    any suggestions on how to get this done ?

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,885
    Homework questions are not allowed here. You should talk to your teacher or tutor if you're having difficulty with your coursework.

    You definitely shouldn't use Google to search for examples of regular expression use, or consult the man page for grep, which has an extensive section on this
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Nov 2011
    Posts
    2
    i knw..
    i just want some hint or suggestion on how to approach the question.

  4. #4
    Just Joined!
    Join Date
    Aug 2011
    Posts
    7
    A hint? RTFM.

    I know that's rude and crude, but that's how the rest of us learned.

  5. #5
    Just Joined!
    Join Date
    Dec 2009
    Location
    California
    Posts
    98
    So, you've got a bunch of words in a file. Are they one per line? or is it like a normal text file with a bunch of sentences?

    Assuming it's a bunch of sentences, you'll need to use a command to put each word on it's own line. Have a look at at "tr" for that.

    Your grep command is too complicated. remove the "w". You do need the "i". In the grep man page, look for "class" of characters. You are on the right track with what you have, but the answer is less complex....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •