开发者

how to search for a term only in non test files

I use ack and I like it.

However from time to time I need to search for something in my code base and I want to ignore all the files residing in test directory. Basically all the files which have test in their absolute path should be no开发者_JAVA技巧t included in the search.

How do I achieve that?

I am willing to have a custom bash script. Something like

ack_no_test "application" -> search for "application" in all files but ignore files residing in test directory


From man ack:

--[no]ignore-dir=DIRNAME
Ignore directory (as CVS, .svn, etc are ignored). May be used multiple times to ignore multiple directories. For example, mason users may wish to include --ignore-dir=data. The --noignore-dir option allows users to search directories which would normally be ignored (perhaps to research the contents of .svn/props directories).


one could add "test" to the "repodirs" var in findrepo.

Personally I think ack to too complicated/slow and "non unixy", as it doesn't reuse the existing unix toolkit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜