{ 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@domain.com
grep -r -i --include \*.h --include \*.cpp CP_Image ~/path[12345] | mailx -s GREP email@domain.com
grep -r --include=\*.txt 'searchterm' ./
grep -r -i --include=\*.txt 'searchterm' ./
grep -rnw "some thing to grep" --include=*.{module,inc,php,js,css,html,htm} ./
find . -name '*.h' -o -name '*.cpp' -exec grep "CP_Image" {} \; -print
find . -name "*.c" | xargs grep -i "my great text"
find -type f -regex ".*\.\(h\|cpp\)"
# ^^^^^^^^^^^^^^^^^^^^^^^
find -type f -regex ".*\.\(h\|cpp\)" -exec grep "your pattern" {} +
find -type f \( -name '*.h' -o -name '*.cpp' \) -exec grep "your pattern" {} +
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grep "your pattern" -r --include=*.{cpp,h}
# ^^^^^^^^^^^^^^^^^^^
find . -type f -name '*.extension' | xargs grep -i string
grep -r -i --include \*.h --include \*.cpp CP_Image ~/path[12345] | mailx -s GREP email@domain.com
grep -r -i --include \*.{h,cpp} CP_Image ~/path[12345] | mailx -s GREP email@domain.com
-G --file-search-regex PATTERN
Only search files whose names match PATTERN.
ag -G *.h -G *.cpp CP_Image <path>
find . -name '*.h' -exec grep -Hn "CP_Image" {} \; -o -name '*.cpp' -exec grep -Hn "CP_Image" {} \;
find . \( -name '*.h' -o -name '*.cpp' \) -exec grep -Hn "CP_Image" {} \;