OT: "find" command with branch/pipe

Rainer Müller raimue at macports.org
Mon Nov 8 08:36:31 PST 2010


On 2010-11-08 11:57 , Andre Massing wrote:
> Sorry this question is not directly macports related, but I would like 
> to ask anyway since there are hopefully some
> terminal / find /regexp experts :)
> I am struggling with the find command, trying to find all files ending 
> with .h or .cpp in a certain directory.
> On my former linux machine the following worked as intended:
> find   ./ -regextype grep -regex '.*\.\(\(h\)\|\(cpp\)'
> but Apple's find command does neither know the regextype option nor does 
> it work as expected if I omit it. I tried already different kind of
> grouping and escaping but without success. Has anybody an idea how I can 
> get find to work as intended?
> Thanks for any pointer or advice!

On your Linux machine you were probably using gfind. You can install GNU
find using the port findutils from MacPorts. It will be installed as
'gfind' by default to distinguish it from the BSD binary provided by Apple.

Rainer


More information about the macports-users mailing list