Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find for YML and YAML files on bash find

Tags:

find

bash

zsh

I am trying to find all .yaml and .yml

I tried

find . -name '*.{yml,yaml}' -exec echo "{}" \;

But no results

Neither in the following way

find . -name '*.yml' -name '*.yaml' -exec echo "{}" \;

Returns nothing.

Is it possible to use the find command to search for both extensions?

like image 298
Rodrigo Avatar asked Sep 02 '25 10:09

Rodrigo


1 Answers

With GNU find find none or one a:

find . -regextype egrep -regex '.*ya?ml$'

or

find . -regextype egrep -regex '.*ya{0,1}ml$'

See: man find

like image 185
Cyrus Avatar answered Sep 04 '25 01:09

Cyrus