Skip to content
Advertisement

How to find only the lines that contain two consecutive vowels

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

JavaScript

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:

JavaScript

Here is an online demo:

JavaScript

Output:

JavaScript
Advertisement