I am currently using
find . -name '*.[cCHh][cC]' -exec grep -nHr "$1" {} ; \
find . -name '*.[cCHh]' -exec grep -nHr "$1" {} ;
to search for a string in all files ending with .c, .C, .h, .H, .cc and .CC listed in all subdirectories. But since this includes two commands this feels inefficient.
How can I use a single regex pattern to find .c,.C,.h,.H,.cc and .CC files?
I am using bash on a Linux machine.
You can use the boolean OR argument:
The above searches the current directory and all sub-directories for files that end in:
.c,.hOR.C,.HOR.ccOR.CC.