The question you tried to load has been merged into the question below

Asked • 03/14/19

grep, but only certain file extensions?

I am working on writing some scripts to `grep` certain directories, but these directories contain all sorts of file types. I want to `grep` just `.h` and `.cpp` for now, but maybe a few others in the future. So far I have: { grep -r -i CP_Image ~/path1/; grep -r -i CP_Image ~/path2/; grep -r -i CP_Image ~/path3/; grep -r -i CP_Image ~/path4/; grep -r -i CP_Image ~/path5/;} | mailx -s GREP [email protected] Can anyone show me how I would now add just the specific file extensions?

3 Answers By Expert Tutors

By:

Charles M. answered • 05/26/19

Tutor
4.9 (866)

Software engineer with 30+ years experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.