LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to use find to build a list of files with *.cpp *.h *.cc *.mm *.java extensions (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-find-to-build-a-list-of-files-with-%2A-cpp-%2A-h-%2A-cc-%2A-mm-%2A-java-extensions-738663/)

n179911 07-08-2009 12:36 PM

how to use find to build a list of files with *.cpp *.h *.cc *.mm *.java extensions
 
Hi,

How can I use find to build a list of files with *.cpp *.h *.cc *.mm *.java extensions?

I tried
find . -name "*.cpp|*.h|*.java|*.cc|*.mm" -print

That prints out nothing.

Thank you.

Tinkster 07-08-2009 12:45 PM

That won't work because shell globbing isn't regex pattern matching.

Code:

find . \( -name "*.cpp" -o -name "*.cc"  \) -print
You get the idea.



Cheers,
Tink

pixellany 07-08-2009 12:52 PM

Take a look at "man find"---especially the -regex option

lemon09 07-08-2009 01:14 PM

there are other tools too....
´locate´ and ´grep´ are such tools(very powerful)
you can use them along with ´find´


All times are GMT -5. The time now is 05:48 AM.