Need to *always* exclude some file types

7 views
Skip to first unread message

turnstep

unread,
Jun 14, 2009, 10:56:36 PM6/14/09
to ack dev/users
I've got a directory full of files, but I often find myself only
needing to grep (in the generic verb sort of sense!) some of the
files. However, ack overrides my exclusion rules because I pass in the
files on the command line:

$ ack foobar A*

This is annoying because there are files like ACME~, ARROWHEAD.tmp
etc. that show up but I don't want them to. Most annoying of all, the
emacs backup files usually end up double the matches, as the same
strings in both ACME and ACME~ get found. What's some good workarounds
for this? Ideally, I'd like to be able to tell ack: "*always* exclude
files of these types, even if I provide them on the command line".

Andy Lester

unread,
Jun 14, 2009, 11:01:20 PM6/14/09
to ack-...@googlegroups.com

On Jun 14, 2009, at 9:56 PM, turnstep wrote:

> Ideally, I'd like to be able to tell ack: "*always* exclude
> files of these types, even if I provide them on the command line".


This is intentional. My intent is that if you specify something on
the command line, ack should not try to second-guess you.

If we had an --exclude-files='A*.tmp' then you could do

$ ack foo A* --exclude-files='A*.tmp'

or even more likely

$ ack foo A* --exclude-files='*.tmp'

Basically, if it's on the command line, ack better believe it.

xoa

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


Andy Lester

unread,
Jun 14, 2009, 11:02:09 PM6/14/09
to ack-...@googlegroups.com

On Jun 14, 2009, at 10:01 PM, Andy Lester wrote:

> This is intentional. My intent is that if you specify something on
> the command line, ack should not try to second-guess you.
>

> Basically, if it's on the command line, ack better believe it.


Some of these philosophical issues need to get into the as-yet-
unwritten ack FAQ.

xoxo,
Andy

Bill Ricker

unread,
Jun 14, 2009, 11:20:56 PM6/14/09
to ack-...@googlegroups.com
>> This is intentional.  My intent is that if you specify something on
>> the command line, ack should not try to second-guess you.
>> Basically, if it's on the command line, ack better believe it.
> Some of these philosophical issues need to get into the as-yet-
> unwritten ack FAQ.

I don't see how that could be debatable 'philosophy' .

isn't that axiomatic at the command line ?

but yes, documenting assumptions and philospophy is important for
external communications and spinning up new community members too.


--
Bill
n1...@arrl.net bill....@gmail.com

Sitaram Chamarty

unread,
Jun 15, 2009, 5:54:50 AM6/15/09
to ack-...@googlegroups.com


On Mon, Jun 15, 2009 at 8:31 AM, Andy Lester <an...@petdance.com> wrote:


On Jun 14, 2009, at 9:56 PM, turnstep wrote:

> Ideally, I'd like to be able to tell ack: "*always* exclude
> files of these types, even if I provide them on the command line".


This is intentional.  My intent is that if you specify something on
the command line, ack should not try to second-guess you.

unless you specify a file like /proc/mounts (or indeed anything in /proc), as I once found out after a fair bit of hair-tearing.

Turned out ack doesn't like files that advertise themselves as zero length but actually contain data.

Probably atypical for most users, I agree.

Andy: I wrote up a very detailed doc sometime after that -- did you get a chance to put it somewhere yet? I admit I haven't checked the website lately; you may well have done so by now.

Sitaram Chamarty

unread,
Jun 15, 2009, 6:04:23 AM6/15/09
to ack-...@googlegroups.com
I just saw this comment **after** I sent my previous reply in the other thread.

On Mon, Jun 15, 2009 at 8:50 AM, Bill Ricker <bill....@gmail.com> wrote:

>> This is intentional.  My intent is that if you specify something on
>> the command line, ack should not try to second-guess you.
>> Basically, if it's on the command line, ack better believe it.
> Some of these philosophical issues need to get into the as-yet-
> unwritten ack FAQ.

I don't see how that could be debatable 'philosophy' .

isn't that axiomatic at the command line ?

heh :-)

but yes, documenting assumptions and philospophy is important for
external communications and spinning up new community members too.


here's some docs I wrote a long time ago.  A quick (not thorough) look at betterthangrep.com turned up no sign of them and the version of ack hasn't bumped since the last time I checked so I'm assuming this writeup hasn't had a more substantial airing:

http://groups.google.com/group/ack-users/browse_thread/thread/91d95a012be2905a
Reply all
Reply to author
Forward
0 new messages