Documentation on --ignore-file?

665 views
Skip to first unread message

DelvarWorld

unread,
Jun 7, 2013, 3:01:07 PM6/7/13
to ack-...@googlegroups.com
This page is a mess in terms of --ignore-file:


I was lucky enough to find an example ackrc through google that showed

--ignore-file=match:file.txt
--ignore-file=match:/regexp/

but beyond that I have no idea what my options are for --ignore-file. I am also trying to construct a regex with forward slashes in it but it doesn't seem to be working. The documentation is very lacking in terms of how to do this.

Andy Lester

unread,
Jun 7, 2013, 3:22:23 PM6/7/13
to ack-...@googlegroups.com

On Jun 7, 2013, at 2:01 PM, DelvarWorld <delva...@gmail.com> wrote:

This page is a mess in terms of --ignore-file:



Did you look at the man page, either by running "man ack" or "ack --man"?  Did you look at the "ack manual" linked the top of the page?

Did you think that all of the documentation for ack was that single web page at http://beyondgrep.com/documentation/ ?


Please note that I do NOT mean for those questions to be accusatory or insulting.  I'm trying to understand why you couldn't find the documentation about --ignore-file.

The ack manual says:


       −−ignore−file=FILTERTYPE:FILTERARGS
           Ignore files matching FILTERTYPE:FILTERARGS.  The filters are
           specified identically to file type filters as seen in "Defining
           your own types".

Defining your own types
       ack allows you to define your own types in addition to the predefined
       types. This is done with command line options that are best put into an
       .ackrc file − then you do not have to define your types over and over
       again. In the following examples the options will always be shown on
       one command line so that they can be easily copy & pasted.

       ack −−perl foo searches for foo in all perl files. ack −−help=types
       tells you, that perl files are files ending in .pl, .pm, .pod or .t. So
       what if you would like to include .xs files as well when searching for
       −−perl files? ack −−type−add perl:ext:xs −−perl foo does this for you.
       −−type−add appends additional extensions to an existing type.

       If you want to define a new type, or completely redefine an existing
       type, then use −−type−set. ack −−type−set eiffel:ext:e,eiffel defines
       the type eiffel to include files with the extensions .e or .eiffel. So
       to search for all eiffel files containing the word Bertrand use ack
       −−type−set eiffel:ext:e,eiffel −−eiffel Bertrand.  As usual, you can
       also write −−type=eiffel instead of −−eiffel. Negation also works, so
       −−noeiffel excludes all eiffel files from a search. Redefining also
       works: ack −−type−set cc:ext:c,h and .xs files no longer belong to the
       type cc.

       When defining your own types in the .ackrc file you have to use the
       following:

         −−type−set=eiffel:ext:e,eiffel

       or writing on separate lines

         −−type−set
         eiffel:ext:e,eiffel

       The following does NOT work in the .ackrc file:

         −−type−set eiffel:ext:e,eiffel

       In order to see all currently defined types, use −−help−types, e.g.
       ack −−type−set backup:ext:bak −−type−add perl:ext:perl −−help−types

       In addition to filtering based on extension (like ack 1.x allowed), ack
       2 offers additional filter types.  The generic syntax is −−type−set
       TYPE:FILTER:FILTERARGS; FILTERARGS depends on the value of FILTER.

       is:FILENAME
           is filters match the target filename exactly.  It takes exactly one
           argument, which is the name of the file to match.

           Example:

               −−type−set make:is:Makefile

       ext:EXTENSION[,EXTENSION2[,...]]
           ext filters match the extension of the target file against a list
           of extensions.  No leading dot is needed for the extensions.

           Example:

               −−type−set perl:ext:pl,pm,t

       match:PATTERN
           match filters match the target filename against a regular
           expression.  The regular expression is made case insensitive for
           the search.

           Example:

               −−type−set make:match:/(gnu)?makefile/

       firstlinematch:PATTERN
           firstlinematch matches the first line of the target file against a
           regular expression.  Like match, the regular expression is made
           case insensitive.

           Example:

               −−type−add perl:firstlinematch:/perl/

       More filter types may be made available in the future.



Thanks,
xoa

--
Andy Lester => an...@petdance.com => www.petdance.com => AIM:petdance

DelvarWorld

unread,
Jun 7, 2013, 6:08:10 PM6/7/13
to ack-...@googlegroups.com
No, I skipped over the "please read the ack manual" text, because that did not look like documentation so there was no point in me reading it while looking for documentation.

I did not try man ack because I have found man pages to be poorly written and hard to follow (see the sociopathic hell that is man grep).

I just googled for 'ack documentation' and 'ack --ignore-file' and didn't find an answer to my question.

It seems odd that the page labeled "documentation" on the main website does not have the correct documentation.

and, it looks like my regex was failing because --ignore-file does not take into account the path :( . Oh well. Thank you for pointing me to the right place.

Andy Lester

unread,
Jun 7, 2013, 6:19:57 PM6/7/13
to ack-...@googlegroups.com
On Jun 7, 2013, at 5:08 PM, DelvarWorld <delva...@gmail.com> wrote:

No, I skipped over the "please read the ack manual" text, because that did not look like documentation so there was no point in me reading it while looking for documentation.

What is the difference between "manual" and "documentation" to you?

xoa

Packy Anderson

unread,
Jun 7, 2013, 8:11:09 PM6/7/13
to Ack Users
Conversely, if a "manual" isn't "documentation", why did the OP skip over the link to the "ack FAQ"? Even if I dislike reading man pages, FAQs generally have the information I'm looking for, and by visiting the ack FAQ and searching in the page for "ignore-file" I found the explanation on how to use the option. 


--
You received this message because you are subscribed to the Google Groups "ack users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ack-users+...@googlegroups.com.
To post to this group, send email to ack-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ack-users?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Packy Anderson

Email:  PackyA...@gmail.com
GVoice: (646) 833-8832

Andy Lester

unread,
Jun 7, 2013, 9:05:01 PM6/7/13
to ack-...@googlegroups.com

On Jun 7, 2013, at 7:11 PM, Packy Anderson <packya...@gmail.com> wrote:

> Conversely, if a "manual" isn't "documentation", why did the OP skip over the link to the "ack FAQ"?

I don't want to point fingers or say "You did wrong." I'm just looking for ways that I could improve the site. If there's something I can do that somehow makes things easier to find, I'm all for it.

Sigfried Gold

unread,
Jul 31, 2017, 8:46:20 AM7/31/17
to ack users
I know this is super old, but I think there's still a doc problem. I *did* immediately try `man ack` after adding `--ignore-file=foo.js` to my .ackrc and getting errors (`Use of uninitialized value $args in split at /usr/local/bin/ack line 4045.
Unknown filter type 'foo.js' at /usr/local/bin/ack line 4045.`). The part on ignore-file says:

       --ignore-file=FILTERTYPE:FILTERARGS
           Ignore files matching FILTERTYPE:FILTERARGS.  The filters are specified identically to file type filters as seen in "Defining your own types".

But I didn't think I needed to add my own type just to ignore a file, and searching the man page for FILTERTYPE got me nothing. I also wasted time searching for .ackrc documentation, not realizing for a while that the .ackrc settings I needed were just normal ack options.

I think the syntax for FILTERTYPE:FILTERARGS should be prominently accessible near --ignore-file or at the top of the man page.

Oh, and embarrassing to mention, but, I've been a very happy ack user for a couple years now and still was dense enough to have to discover this thread in order to see that what I needed was `--ignore-file=match:foo.js`.

Thanks!

Andy Lester

unread,
Jul 31, 2017, 9:15:46 AM7/31/17
to ack-...@googlegroups.com
> I think the syntax for FILTERTYPE:FILTERARGS should be prominently accessible near --ignore-file or at the top of the man page.

Agreed, and I’m sorry for the hassle. We’ve updated this in ack 3, which is nearing an alpha release.


> Oh, and embarrassing to mention, but, I've been a very happy ack user for a couple years now and still was dense enough to have to discover this thread in order to see that what I needed was `--ignore-file=match:foo.js`.

Or `—ignore-file=is:foo.js`. The “match” filter treats “foo.js” as a regex, which happens to work in this case.

Bill Ricker

unread,
Jul 31, 2017, 12:50:26 PM7/31/17
to ack-...@googlegroups.com


On Jul 31, 2017 9:15 AM, "Andy Lester" <an...@petdance.com> wrote:
> I think the syntax for FILTERTYPE:FILTERARGS should be prominently accessible near --ignore-file or at the top of the man page.

Agreed, and I’m sorry for the hassle.  We’ve updated this in ack 3, which is nearing an alpha release.

Which raises the question of how the beyondg documentation, FAQ pages should support legacy ack2 users and early ack3 adopters in parallel. 
  Describe what is common and what is different on one Doc page? Or fork Doc2, doc3, FAQ2, Faq3 ?
   (Tradeoffs!)

(I think it is obvious that web should have man2 and man3 pages.)

(( sadly I understand a prejudice against the *nix MAN pags since so few are well written or even usable by anyone not a maintainer or regular user just looking for a twiddle, but why such a one would expect a Doc page **by the same author** would be any better IDK. That's what stackoverflow is for. 😣 Guessing since OP googled that they didn't realize the inclusive BeyondGrep.com was the home page of the Ack project and thus perpetrated by the same culprits as man ack. ))

Andy Lester

unread,
Jul 31, 2017, 12:56:38 PM7/31/17
to ack-...@googlegroups.com
> Which raises the question of how the beyondg documentation, FAQ pages should support legacy ack2 users and early ack3 adopters in parallel.

We’ll keep ack2 docs around. That’s already part of the redesign.


> (( sadly I understand a prejudice against the *nix MAN pags since so few are well written or even usable by anyone not a maintainer or regular user just looking for a twiddle, but why such a one would expect a Doc page **by the same author** would be any better IDK. That's what stackoverflow is for. 😣 Guessing since OP googled that they didn't realize the inclusive BeyondGrep.com was the home page of the Ack project and thus perpetrated by the same culprits as man ack. ))


We want to make that connection clearer, too.

Reply all
Reply to author
Forward
0 new messages