Home > front end >  List files with 'ls' that have at least two vowels in linux shell
List files with 'ls' that have at least two vowels in linux shell

Time:11-08

I'm stuck with this problem:

List all files with ls that have at least two vowels in any position and end with .c, .h or .s

I have come with a partial solution : ls *{a,e,i,o,u}*.[chs]

But obviously this does not fulfill the problem requirements because it list all files that have any numbers of vowel, not two or more.

CodePudding user response:

I'd use a character class for the vowels, too

ls *[aeiou]*[aeiou]*.[chs]

Using the bracket expansion is possible, too, but some files are then listed multiple times:

ls *{a,e,i,o,u}*{a,e,i,o,u}*.[chs]
  • Related