I love ack.
I need to search for 'foo' in all the files except the test files.
ack has option -G to specify regex. However I am not sure how do I write regex for the condition that look for all files but ignore files with word 'test'.
I love ack.
I need to search for 'foo' in all the files except the test files.
ack has option -G to specify regex. However I am not sure how do I write regex for the condition that look for all files but ignore files with word 'test'.
Starting with ack 2.0, you need to specify a file type and then filter based on it. In this case, you want to skip files with the word test in them:
ack --type-set testfiles:match:'test' --type=notestfiles pattern
Note: I'm using the negative of the file type testifies
, so I've appended no
to filetype, as per the documentation:
--type=noX Exclude X files. See "ack --help-types" for supported filetypes.