bug-grep
[Top][All Lists]
Advanced

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

Re: Problems using + with -f <file>


From: Julian Foad
Subject: Re: Problems using + with -f <file>
Date: Tue, 11 Jul 2006 22:02:26 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Gert Jan van Loo wrote:
[...]
My pattern file contains (among other lines):
Input [a-zA-Z0-9_]+ is unused
If I use "grep -f <patternfile> <source>" The patterns are NOT found If I use "egrep -f <patternfile> <source>" The patterns ARE found If I change my pattern file to:
Input [a-zA-Z0-9_]\+ is unused
Now using "grep -f <patternfile> <source>" The patterns ARE found.
Now using "egrep -f <patternfile> <source>" The patterns are NOT found.

egrep seems to do the right thing. I thought "[a-zA-Z0-9_]+" is part of the standard grep. Even if it is not why does \+ suddenly work?

All of this is working as intended, and as documented. GNU "grep" uses BRE syntax, but it has exactly the same ERE capabilities as "egrep". Those capabilities are accessed by escaping ERE characters with "\" to give them their special meaning.

- Julian




reply via email to

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