GNU bug report logs -
#58134
grep for windows Include GLOB pattern with double star doesn't seem to work
Previous Next
Full log
View this message in rfc822 format
Thanks Paul, looks like the syntax reference I was using was not the right one.
What I'm really trying to do is a bit more complex and I cannot figure out if it's just not a supported feature of grep or if I'm not able to come up with the right syntax for it.
I am trying to make an include filter which will match any xml file that is in a folder with a specific name, no matter how deep that folder is.
For instance, if I run the grep command from /, and I have the files:
/a/b/folder/file.xml
/a/b/file2.xml
/a/folder/file3.xml
/folder/file4.xml
I want to match the file.xml, file3.xml and file4.xml, but not file2.xml, because it is not under a folder named "folder".
The command I would imagine would look something like:
grep -l --include="*/folder/*.xml" pattern .
I tried a couple different ways to write this and nothing worked, I wonder if grep just does not support this feature.
Note that I'm using the grep for Windows, so I don't have the typical linux tools or shell expansion tricks I can use, I'm trying to do this all in grep.
-----Original Message-----
From: Paul Eggert <eggert <at> cs.ucla.edu>
Sent: Wednesday, September 28, 2022 10:07 AM
To: Alex Benoit <Alexandre.Benoit <at> microsoft.com>
Cc: 58134-done <at> debbugs.gnu.org
Subject: [EXTERNAL] Re: bug#58134: grep for windows Include GLOB pattern with double star doesn't seem to work
On 9/27/22 16:19, Alex Benoit via Bug reports for GNU grep wrote:
> However, this worked:
> grep -rl --include="*.xml" foo .
>
> Is the double star supported on Windows?
Yes and no. It's a POSIX glob, which means "**" is equivalent to "*",
and that's what's supported. Whether it's MS-Windows shouldn't matter.
> What is the proper way to do it?
Looks like you found it already.
This bug report was last modified 2 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.