How can I get ack to ignore *.orig files?
Asked Answered
P

4

38

I put this in my .ackrc:

--type-set=DUMB=*.orig
--noDUMB

... but I'm still seeing files like main.py.orig in my ack results. I tried doing --type-set=DUMB=*.*.orig too, but that didn't work either.

More info

Run from my command line (OSX Snow Leopard with :

timmfin at lorien in ~/dev/performable/rafa on landing-pages-csv-and-more!
± ack modules --python | grep '.orig'
src/rafa/main.py.orig:25:import rafa.ui.modules.helpers
src/rafa/main.py.orig:26:from rafa.ui.modules.performable_form import PerformableForm
src/rafa/main.py.orig:27:from rafa.ui.modules.page_form import PageEditForm
src/rafa/main.py.orig:28:from rafa.ui.modules.settings_form import SettingsForm
....

timmfin at lorien in ~/dev/performable/rafa on landing-pages-csv-and-more!
± cat ~/.ackrc 
--color
--sort-files
--smart-case

--type-set=sass=.sass
--type-set=coffee=.coffee

--ignore-dir=rafa/static
--ignore-dir=compiled
--ignore-dir=compressed

--ignore-dir=venv
--ignore-dir=build

timmfin at lorien in ~/dev/performable/rafa on landing-pages-csv-and-more!
± ack --version
ack 1.94
Running under Perl 5.10.0 at /usr/bin/perl
Poleyn answered 20/1, 2011 at 14:49 Comment(0)
B
20

For ack version 1.x

I found this worked if I removed the asterisk (from the Ackmate wiki)

--type-set=DUMB=.orig
--noDUMB

You can see what types of file ackmate supports by running (including those you've specified in ~/.ackrc):

~/Library/Application\ Support/TextMate/PlugIns/AckMate.tmplugin/Contents/Resources/ackmate_ack --help type
Busoni answered 17/5, 2011 at 19:6 Comment(0)
C
89

Now that ack 2.0 is available:

--ignore-file=ext:orig

, either on command line or .ackrc.

It is possible to ignore files by name. To ignore ctags generated files:

--ignore-file=is:tags

Filters for different uses can be found on documentation.

Cutaway answered 24/10, 2013 at 12:29 Comment(2)
I wish this would be updated to the "accepted answer", this is the best way to do it now!Conference
You can use match along with a regex to match filenames and ext for extensions. Exclude js files --ignore-file=ext:js. Exclude files with name foo and bar --ignore-file='match:/foo|bar/'. Escape the parameter with quotes in case of regex with | so that shell doesn't execute it as a pipe.Hightower
B
20

For ack version 1.x

I found this worked if I removed the asterisk (from the Ackmate wiki)

--type-set=DUMB=.orig
--noDUMB

You can see what types of file ackmate supports by running (including those you've specified in ~/.ackrc):

~/Library/Application\ Support/TextMate/PlugIns/AckMate.tmplugin/Contents/Resources/ackmate_ack --help type
Busoni answered 17/5, 2011 at 19:6 Comment(0)
C
1

For ack version 1.x use the following. In my case, I want to ignore .css files. I have to set the type called SOMETHING. Then set it to --noSOMETHING to remove it from search.

 ack --type-set=SOMETHING=.css --noSOMETHING "My Bitcoin."

enter image description here

Commuter answered 16/3, 2016 at 14:26 Comment(0)
C
0

ack doesn't recognize .orig files in the first place. I'm guessing you are somehow invoking ack -a either from your ackrc or ACK_OPTIONS.

Constipate answered 28/2, 2011 at 21:51 Comment(4)
I mainly use Ack via the AckMate plugin for Textmate (and I'm not sure what options it uses other than my .ackrc), but I also see the problem from ack on the command line. Updated my question for more detailPoleyn
Try it with --noenv and see if your .orig get ignored. Also, could your ack be aliased to ack -a? Also, use ack -f to get a list of all the files that ack is interested in.Constipate
i got ack: Invalid option in ~/.ackrcTwoedged
When did you get that error message? What did you do in your ~/.ackrc?Constipate

© 2022 - 2024 — McMap. All rights reserved.