Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Find for YML and YAML files on bash find

I am trying to find all .yaml and .yml

I tried

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

But no results

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading