Nick Vanderbilt
Nick Vanderbilt

Reputation: 38450

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 only search through files or directory with name test. I want reverse of it.

ack foo --rb -G test

Upvotes: 0

Views: 64

Answers (1)

John Kugelman
John Kugelman

Reputation: 361605

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.

Upvotes: 1

Related Questions