LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-29-2007, 05:54 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
find command


Hello everyone,


I want to find all files in current directory (including sub-directory) whose name is *.c or *.h or *.cpp. How to write the find command?


thanks in advance,
George
 
Old 08-29-2007, 06:45 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393Reputation: 2393
Hi,

This should work:

find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -print

-o stands for OR.

Hope this helps.
 
Old 08-30-2007, 02:42 AM   #3
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thanks druuna,


Quote:
Originally Posted by druuna View Post
Hi,

This should work:

find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -print

-o stands for OR.

Hope this helps.
Your solution works!


regards,
George
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 06:30 PM
find command czy11421 Linux - Software 8 07-04-2007 10:17 PM
find command brazilian_user Linux - General 1 09-12-2006 10:50 AM
find command DotHQ Red Hat 3 04-24-2006 07:02 AM
find command talkinggoat Linux - Newbie 4 10-05-2003 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration