Syntax for find on Mac OS X

Posted by hekevintran on Super User See other posts from Super User or by hekevintran
Published on 2010-03-10T08:20:56Z Indexed on 2010/04/05 10:33 UTC
Read the original article Hit count: 530

Filed under:
|
|
|
|

I have a project directory that contains source code and subdirectories of source code. I want to use the Unix program find to search recursively for the names of files of certain extensions. The versions of find on Linux and Mac OS X behave differently.

# Works in Linux
find . -type f -regex ".*\.\(py\|html\)$"

# Neither of these works in Mac OS X
find . -type f -regex ".*\.\(py\|html\)$"
find . -type f -regex ".*\.(py|html)$"

How do I write this command so that it will run on Mac OS X (and hopefully on Linux too)?

© Super User or respective owner

Related posts about unix

Related posts about find