bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17763: grep --exclude does not match files as documented in man page


From: ANDREUX Hugues
Subject: bug#17763: grep --exclude does not match files as documented in man page
Date: Thu, 12 Jun 2014 12:05:52 +0000

It seems file globbing as done by 'grep --exclude' is broken when wildcards are 
used.

$ echo foo >bar
$ grep --exclude='.*' . ./bar
$ grep --exclude='.*' . bar
foo

Expected behavior: grep -exclude should not exclude bar, whether it is prefixed 
by ./ or not. According to the man page:
"       --exclude=GLOB
              Skip files whose *base name* matches GLOB (using wildcard 
matching). [...]"

This behavior seems to only occur with whenever a directory component of the 
file path matches the GLOB, e.g.:
$ grep --exclude '.*' . ../bar
$ grep --exclude '.*' . .../bar
$ grep --exclude '.*' . .TEST/bar
$ grep --exclude '.*' . hugues/.TEST/bar

The bug triggers with other globs, unless there is no wildcard:
$ grep --exclude 'w*' . work/bar
$ grep --exclude 'work' . work/bar
foo

Regards,

Hugues Andreux
*************************************************************************
This message and any attachments (the "message") are confidential, intended 
solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to 
alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be 
liable for the message if altered, changed or
falsified.
Please visit http://swapdisclosure.sgcib.com for important information with 
respect to derivative products.
                              ************
Ce message et toutes les pieces jointes (ci-apres le "message") sont 
confidentiels et susceptibles de contenir des informations couvertes 
par le secret professionnel. 
Ce message est etabli a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de 
ce message s'il a ete altere, deforme ou falsifie.
Veuillez consulter le site http://swapdisclosure.sgcib.com afin de recueillir 
d'importantes informations sur les produits derives.
*************************************************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]