Skip to content
Advertisement

How could I write an egrep command that will find all entries that have least 5 consecutive vowels (aeiou) in them upper or lower case?

I’m looking for an answer that doesnt include -i option to get both upper and lowercase. Specifically just how to make the regular expression itself output such a string.

I also do not want it to return any other strings outside of the consecutive “aeiou”. For example I want to see:

aeiou AEIOU AeIou daeiou aeioud

etc.

I do not want to see: AAAAA aeiou AEIOU AeIou daeiou aeioud AEODN EEEEE eaeee

when I do grep -E ‘[aeiou-AEIOU]{5,} it is still giving me additional strings like the ones above I do not want to see. Any ideas??

Advertisement

Answer

If you can’t use -i, things like [aA] will serve instead to match an upper or lower case version of a particular letter:

grep '[aA][eE][iI][oO][uU]' <<< '"AEIOU" "aEioU" "daeiou" "aeiouF"'

Works fine with basic regular expressions, no need for extended (Which should be used via grep -E, not the obsolete egrep, by the way).

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement