[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58134: grep for windows Include GLOB pattern with double star doesn'
From: |
Alex Benoit |
Subject: |
bug#58134: grep for windows Include GLOB pattern with double star doesn't seem to work |
Date: |
Wed, 28 Sep 2022 17:29:35 +0000 |
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@cs.ucla.edu>
Sent: Wednesday, September 28, 2022 10:07 AM
To: Alex Benoit <Alexandre.Benoit@microsoft.com>
Cc: 58134-done@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.