University Crest

[wlug] how to find files with multiple suffixes

wlug archive index About the wlug list Mailing lists home
To The University of Waikato HomepageWaikato Home > Waikato Mailing Lists > wlug Info > wlug archives
John R. McPherson jrm21@c...
Tue Apr 20 21:09:39 NZST 2004

On Tue, Apr 20, 2004 at 09:05:28PM +1200, Glenn Ramsey wrote:
> How do I find files having either of several extensions?
> Eg this finds all .c and .h files
> $find . -name '*.[ch]'
> but what if I want to find all .cpp and .h files?
> I guess I need a grouping operator in the pattern but I can't figure out 
> what it is.

Use "-o" for "or":

 find . -name \*.cpp -o -name \*.h


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the wlug mailing list
NOTICE: This is an archive of a public mailing list. The University of Waikato is not responsible for its contents.

The University of Waikato - Te Whare Wananga o Waikato