How to let ack support more filetypes?
Asked Answered
R

2

45

in ack's home page, there lists a lot of file type, but without aspx, is it possible to let ack support it?

Rawdan answered 6/10, 2010 at 8:19 Comment(0)
R
76

On window,add .ackrc file under C:\Documents and Settings\yourname,with content

--type-set=aspx=.aspx

you can set a type to multi file extension,seperate by ","

--type-set=aspx=.aspx,.ascx
Note

ack syntax and behaviour has changed significantly with version 2. The equivalent of the above in version 2 would be:

--type-set=aspx:ext:aspx,ascx

Where the syntax is --type-set TYPE:FILTER:FILTERARGS and FILTER can be any of ext, is, match, firstlinematch. You should definitely read the man page for detailed explanation.

see

Rawdan answered 6/10, 2010 at 9:55 Comment(2)
+1 The man page says "If you want to define a new type, or completely redefine an existing type, then use --type-set."Sweltering
for ubuntu place .ackrc under /home/<username>/Galengalena
C
12
--type-add TYPE=.EXTENSION[,.EXT2[,...]]
                    Files with the given EXTENSION(s) are recognized as
                    being of (the existing) type TYPE

from http://betterthangrep.com/

You can add this to .ackrc in your homedirectory.

Colloidal answered 6/10, 2010 at 8:43 Comment(2)
The better way to do this is with --type-set.Testa
Yes, this answer is much better. The other one causes all your other files to no longer be found. If you're going to put this in the .ackrc file, you also need an = sign instead of space after --type-add.Axil

© 2022 - 2024 — McMap. All rights reserved.