GNU bug report logs - #15452
Comparing files whose name _do_ match a certain pattern

Previous Next

Package: diffutils;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Tue, 24 Sep 2013 08:00:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 15452 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Tue, 24 Sep 2013 08:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Tue, 24 Sep 2013 08:00:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-diffutils <at> gnu.org
Subject: Comparing files whose name _do_ match a certain pattern
Date: Tue, 24 Sep 2013 09:59:24 +0200
[Please, keep my address in CC, as I'm not subscribed to this list]

Hello,

I'm badly missing an "--include" option in "diff", which would have
the inverse effect of "--exclude", i.e., to consider only files whose
names _do_ match a certain pattern.

I've been searching the internet and also this mailing list, seeking a
way of doing this, but I've failed so far, and I'm quite surprised
that such a feature isn't implemented already.

What I want is a simple way of comparing two directories which have a
bunch of different file types, and I'm only interested on comparing a
subset of them.  Yes, I have the option of excluding every other
possible filetype, but that would be far more complex to do.

Are there a simple way of doing what I want?  If not, could you
implement that "--include" option?

Thanks in advance.

-- 
Dani Moncayo




Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Tue, 24 Sep 2013 14:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match
 a certain pattern
Date: Tue, 24 Sep 2013 08:08:23 -0600
[Message part 1 (text/plain, inline)]
On 09/24/2013 01:59 AM, Dani Moncayo wrote:
> [Please, keep my address in CC, as I'm not subscribed to this list]
> 
> Hello,
> 
> I'm badly missing an "--include" option in "diff", which would have
> the inverse effect of "--exclude", i.e., to consider only files whose
> names _do_ match a certain pattern.
> 
> I've been searching the internet and also this mailing list, seeking a
> way of doing this, but I've failed so far, and I'm quite surprised
> that such a feature isn't implemented already.

Ah, but why should we bloat diff when find already gives you what you want:

find . -name '*.txt' -exec diff {} other/{} \;

will run diff on only files ending in *.txt, when comparing . against
other/.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Tue, 24 Sep 2013 14:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match
 a certain pattern
Date: Tue, 24 Sep 2013 16:34:25 +0200
> Ah, but why should we bloat diff when find already gives you what you want:
>
> find . -name '*.txt' -exec diff {} other/{} \;
>
> will run diff on only files ending in *.txt, when comparing . against
> other/.

Ah yes, that's one possibility for doing what I want, but I'd
definitely prefer having the "--include" option, because:

1. Simplicity: It would be a lot simpler than the find/diff
combination.  And in the probable case that the "old" directory to
compare is not the current working directory, things get even more
complex, because the files in the "new" directory could not be
expressed in such a simple way ("whatever/{}").

2. Consistency: Why not having an "--include" option when we have an
"--exclude" option?

-- 
Dani Moncayo




Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Tue, 24 Sep 2013 14:47:02 GMT) Full text and rfc822 format available.

Message #14 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match
 a certain pattern
Date: Tue, 24 Sep 2013 16:46:09 +0200
On Tue, Sep 24, 2013 at 4:34 PM, Dani Moncayo <dmoncayo <at> gmail.com> wrote:
>> Ah, but why should we bloat diff when find already gives you what you want:
>>
>> find . -name '*.txt' -exec diff {} other/{} \;
>>
>> will run diff on only files ending in *.txt, when comparing . against
>> other/.
>
> Ah yes, that's one possibility for doing what I want, but I'd
> definitely prefer having the "--include" option, because:
>
> 1. Simplicity: It would be a lot simpler than the find/diff
> combination.  And in the probable case that the "old" directory to
> compare is not the current working directory, things get even more
> complex, because the files in the "new" directory could not be
> expressed in such a simple way ("whatever/{}").
>
> 2. Consistency: Why not having an "--include" option when we have an
> "--exclude" option?

Another reason comes to my mind:

3.  Flexibility: Having the possibility of combining "--include" and
"--exclude" would be quite convenient in some cases.  It would be a
simple way of expressing the intersection of two sets of files.

-- 
Dani Moncayo




Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Tue, 24 Sep 2013 17:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match
 a certain pattern
Date: Tue, 24 Sep 2013 19:25:39 +0200
On Tue, Sep 24, 2013 at 4:46 PM, Dani Moncayo <dmoncayo <at> gmail.com> wrote:
> On Tue, Sep 24, 2013 at 4:34 PM, Dani Moncayo <dmoncayo <at> gmail.com> wrote:
>>> Ah, but why should we bloat diff when find already gives you what you want:
>>>
>>> find . -name '*.txt' -exec diff {} other/{} \;
>>>
>>> will run diff on only files ending in *.txt, when comparing . against
>>> other/.
>>
>> Ah yes, that's one possibility for doing what I want, but I'd
>> definitely prefer having the "--include" option, because:
>>
>> 1. Simplicity: It would be a lot simpler than the find/diff
>> combination.  And in the probable case that the "old" directory to
>> compare is not the current working directory, things get even more
>> complex, because the files in the "new" directory could not be
>> expressed in such a simple way ("whatever/{}").
>>
>> 2. Consistency: Why not having an "--include" option when we have an
>> "--exclude" option?
>
> Another reason comes to my mind:
>
> 3.  Flexibility: Having the possibility of combining "--include" and
> "--exclude" would be quite convenient in some cases.  It would be a
> simple way of expressing the intersection of two sets of files.

Another one:

4. Consistency (II): "grep" has exactly what I'm requesting for "diff":

      --include=FILE_PATTERN  search only files that match FILE_PATTERN
      --exclude=FILE_PATTERN  skip files and directories matching FILE_PATTERN


-- 
Dani Moncayo




Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Wed, 23 Oct 2013 10:40:02 GMT) Full text and rfc822 format available.

Message #20 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match
 a certain pattern
Date: Wed, 23 Oct 2013 12:39:51 +0200
>>>> Ah, but why should we bloat diff when find already gives you what you want:
>>>>
>>>> find . -name '*.txt' -exec diff {} other/{} \;
>>>>
>>>> will run diff on only files ending in *.txt, when comparing . against
>>>> other/.
>>>
>>> Ah yes, that's one possibility for doing what I want, but I'd
>>> definitely prefer having the "--include" option, because:
>>>
>>> 1. Simplicity: It would be a lot simpler than the find/diff
>>> combination.  And in the probable case that the "old" directory to
>>> compare is not the current working directory, things get even more
>>> complex, because the files in the "new" directory could not be
>>> expressed in such a simple way ("whatever/{}").
>>>
>>> 2. Consistency: Why not having an "--include" option when we have an
>>> "--exclude" option?
>>
>> Another reason comes to my mind:
>>
>> 3.  Flexibility: Having the possibility of combining "--include" and
>> "--exclude" would be quite convenient in some cases.  It would be a
>> simple way of expressing the intersection of two sets of files.
>
> Another one:
>
> 4. Consistency (II): "grep" has exactly what I'm requesting for "diff":
>
>       --include=FILE_PATTERN  search only files that match FILE_PATTERN
>       --exclude=FILE_PATTERN  skip files and directories matching FILE_PATTERN

I'm looking forward for this change to be implemented.  Is there some
hope for that to happen?.


-- 
Dani Moncayo




Information forwarded to bug-diffutils <at> gnu.org:
bug#15452; Package diffutils. (Wed, 23 Oct 2013 18:12:02 GMT) Full text and rfc822 format available.

Message #23 received at 15452 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Dani Moncayo <dmoncayo <at> gmail.com>, 15452 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#15452: bug#15452: Comparing files whose name
 _do_ match a certain pattern
Date: Wed, 23 Oct 2013 11:11:17 -0700
On 10/23/13 03:39, Dani Moncayo wrote:
> I'm looking forward for this change to be implemented.  Is there some
> hope for that to happen?.

It'd be nice to have.  I implemented that feature for 'grep'
and would be a good candidate to do the same for 'diff'.
Unfortunately I've got a lot on my plate.  Maybe someone
else can steal the 'grep' code.  It'd be nice if it were
a library so that other programs could use it too.




Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sun, 30 Mar 2014 05:42:01 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.