0

So far I am using grep -E '[aeiou]{2}' /usr/share/dict/american-english. This is giving me two vowels, but I want them to be only vowels in a row, like "tooth", "beer", etc.

So I want to use grep to get a word with a vowel, but only if that vowel is followed by the same vowel. Like, I want to find tooth, I want to see if I can write a command that will look for the first o and see the next character is a o. Is that more clear?

What am I missing?

αғsнιη
  • 41,407
DippyDog
  • 105

1 Answers1

3

Try:

grep -E '([aeiou])\1' infile

With parenthesis we capture a group match where they are accessed by the \1 as back-reference for the first group (if there were more groups, then \2 for the second and so on upto \9 are allowed). so any single vowels character was matched in (....) ([aeiou] means match one of a, e, i, o or u) with \1 we checks it's duplicate itself or not.

αғsнιη
  • 41,407