recursive 的對 .h 和 .cpp 作 grep
一直都不會,通常都是用 grep -r PATTERN * | grep cpp :X,今天被問所以認真的查了一下...
- find DIRECTORY -name '*h' -o -name '*cpp' | xargs grep PATTERN
- grep -r --include '*.h' --include '*cpp' PATTERN * (或DIRECTORY)
Edit: 2009/4/20
alias mygrep 'grep -n -r --include "*.h" --include "*.cpp" \!* *'
之後打 mygrep PATTERN 就好了 =_=
No comments:
Post a Comment