I have problems with greps in Emacs.
a) grep doesn't seem to understand. [ch] to search for .c and .h files. This is the default option provided by Emacs with the lgrep command. This example searches for the word "global" in .c / .h files.
grep -i -nH "global" *.[ch] grep: *.[ch]: No such file or directory Grep exited abnormally with code 2 at Mon Feb 16 19:34:36
Is this format invalid?
b) Using rgrep , I get the following error:
find . "(" -path "*/CVS" -o -path "*/.svn" -o -path "*/{arch}" -o -path "*/.hg" -o -path "*/_darcs" -o -path "*/.git" -o -path "*/.bzr" ")" -prune -o -type f "(" -iname "*.[ch]" ")" -print0 | xargs -0 -e grep -i -nH "global" FIND: Wrong parameter format Grep finished (matches found) at Mon Feb 16 19:37:10
I am using Emacs 22.3.1 on Windows XP with the GNU W32 Utils (grep, find, xargs, etc.). Grep v2.5.3 and find v4.2.20.
What am I missing?
UPDATE:
Too bad that you canโt accept a few answers ... because the solution to my problems is laid out.
grep -i -nH "global" *.c *.h
This solves the first problem. Thanks luapyad!
(setq find-program "c:\\path\\to\\gnuw32\\find.exe")
emacs really used windows find.exe. Forced gnu32 detection fixes the second issue. Thanks scottfrazer.
However, I still like ack .
grep emacs
cschol
source share