how to find lines that contain consecutive vowels
$ (filename) | sed '/[a*e*i*o*u]/!d'
Advertisement
Answer
To find lines that contain consecutive vowels you should consider using
sed -n '/[aeiou]{2,}/p' file
Here, [aeiou]{2,} pattern matches 2 or more occurrences ({2,} is an interval quantifier with the minimum occurrence number set to 2) and [aeiou] is a bracket expression matching any char defined in it.
The -n suppresses output, and the p command prints specific lines only (that is, -n with p only outputs the lines that match your pattern).
Or, you may get the same functionality with grep:
grep '[aeiou]{2,}' file
grep -E '[aeiou]{2,}' file
Here is an online demo:
s="My boomerang
Text here
Koala there"
sed -n '/[aeiou]{2,}/p' <<< "$s"
Output:
My boomerang Koala there