Home > database >  Find for YML and YAML files on bash find
Find for YML and YAML files on bash find

Time:01-13

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?

CodePudding user response:

With GNU find and none or one a:

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

or

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

See: man find

CodePudding user response:

Something like this.

find . \( -name '*.yaml' -o -name '*.yml' \)

  • Related