Wednesday, February 06, 2013

Search in emacs with grep

Search pattern in different directories and different files:

M-x grep RETURN
grep -RnisIw --exclude-dir=bin MPEG2DEC ../

-I suppose to ignore binary files, but for some reason I have to add "--exclude-dir"
../ to search all directories from parent directory. Use ./ to search current directory

If only search all .c files:
grep -RnisIw --exclude-dir=bin --include=*.c MPEG2DEC ../

or exclude all .h files:
grep -RnisIw --exclude=*.h MPEG2DEC ../

M-x rgrep works too, but it has less controls.

No comments:

Post a Comment