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