Everytime I try add a type in ack seem to fail i.e add a type (log
) in ack
ack --type-set log:ext:log
ack: No regular expression found.
or
ack --type-add log:ext:log
ack: No regular expression found.
Anyone has a clue about this or it only
If you want to try out a new type in place, then use a command like this:
ack --type-set proj:ext:csproj --type proj "some search pattern"
this will show you search results for the given type.
If you want to save the type permanently, then you have to add the following line to your $HOME/.ackrc
:
--type-set=proj:ext:csproj
Two things to note:
.ackrc
file should have =
(equals) instead of a space.UPDATE (figured out from the Andy Lester's answer):
Instead of --type your_type_name
you can just write shortcut --your_type_name
.
Do it like this:
ack --type-set=log:ext:log --log searchterm
or if you're trying to ignore log files.
ack --type-set=log:ext:log --nolog searchterm
If this log format is something you're going to refer to a lot, then you'll want to add the line to your .ackrc file. The arguments in your .ackrc get executed every time you run ack.
For more information, see "Defining your own types" after running "ack --man".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With