I need to look in /usr/share/dict/words for a 5-letter word that starts with d or D, followed by a lowercase vowel, and ends with s. I have tried everything but to no avail.

  • 1
    What does "I have tried everything mean"? Please include the commands you have tried in your question so we know what you have attempted. – terdon May 8 '13 at 11:32
grep '^[dD][aeiou]..s$' /usr/share/dict/words
  • ^[dD] - match d or D at the beginning of the line
  • [aeiou] - match a, e, i, o or u
  • .. - match any two characters
  • s$ - match s, followed by the end of the line
  • Note that in my (British) /usr/share/dict/words, there are a lot more vowels than the aeiou characters (even if you don't want to consider y as a vowel). Also note that . matches any character, not only letters (it will typically match the apostrophe in the words file). – Stéphane Chazelas May 8 '13 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.