bug-grep
[Top][All Lists]
Advanced

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

Re: Grep --include does not work


From: LeonM
Subject: Re: Grep --include does not work
Date: Sat, 9 Jun 2007 22:34:58 +1000

Hate to disappoint you. My bug report to the GnuWin32 brought a
different reaction.

Obviously a developer (both those examining the bug report and myself)
realizes that there is definitely a stuff up or bug in the transition
from 2.5.1a to 2.5.1a-1 when they produce totally distinct behaviours
with the same command line argument in the same OS.

Either in processing the file globs or even doing reg exp matching, or
both. They have accepted my bug report and has changed the status. You
may follow the report in reguest ID 1733145.

As a Windows programmer, I have to disagree with your assertion and
dare to say that irrespective of any OS, when two minor version
releases exhibit totally different behaviour, someone have stuffed
that up.

For your information, I have 2 copies of ver 2.5.1 of GNU Win32 grep
(one from one known location and the other unknown) that work
according to the documentation. The only one that fails to conform to
the documentation is version 2.5.1a-1.

Hence I am happy and continue to use the grep. You may disagree with
me, the right syntax to find the string 'include' in any text file
recursively using the Perl Regular Expression is:

grep -R --include="*.txt" -P "include" *

Give this a try with ver 2.5.1a and see for yourself that it works.

Bob

On 6/9/07, Bob Proulx <address@hidden> wrote:
LeonM wrote:
> I have downloaded from
> http://gnuwin32.sourceforge.net/packages/grep.htm

If this is a MS-Windows binary then you need to know that it is a port
of the GNU program and is operating in a mode where behavior is
"mapped" to the MS world.  In particular file globs behave
differently.  There is only so much adaption that can be done and then
the MS world creeps in regardless.  :-(

> the version 2.5.1a and it works according to my reading of the
> documentation. This
> grep -R --include="*.txt" -P include *
>
> works but the version 2.5.1a-1 fails to work correctly.

Just the same, use a '.' instead of '*'.  The '*' is not the best
usage because of file glob expansion.

> So it seems there is either an inconsistent interpretation of the
> combination of switches or some programming logic rendering two
> distinct behaviors. Either reason it is wrong right?

This won't be in the upstream.  In the GNU world the command line
shell does the file glob expansion not the command.  In the MS world
that is done by a library or something that links in with the program
and is therefore part of the command.  Because of this it is
completely different.

If you are concerned about using '*' instead of '.' and the difference
in the '*' case is important then your best option is to report this
to the gnuwin32 people.

Bob





reply via email to

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