How to ignore search through test files
I am using ack and I want to avoid searching through any file which has name test. How do I do that?
Following ensures that onl开发者_JS百科y search through files or directory with name test. I want reverse of it.
ack foo --rb -G test
ack -G '^(?!test$)'
ack -G '^(?!.*test)'
Use the first one to ignore files named exactly test
. Use the second to ignore files with the word test
anywhere inside.
If you want to permanently ignore test files you could edit the is_searchable
function in the ack script. This is the routine which filters out core dumps, swap files, and the like.
精彩评论