Re: grep: BRE with caret
On 21 Aug 2006 15:13:53 -0700, johngnub wrote:
> Chris Mattern wrote:
>> Daniel Mentz wrote:
>>> On Mon, 21 Aug 2006 14:18:26 -0400, Chris Mattern wrote:
>>>
>>>
>>>>Daniel Mentz wrote:
>>>>
>>>>>The following command should find all lines containing "xx^x":
>>>>>grep "xx^x"
>>>>>
>>>>>But it doesn't match lines containing "xx^x".
>>>
>>>
>>>>>I'm using grep (GNU grep) 2.5.1
>>>>
>>>>Using GNU grep 2.5.1:
>>>>
>>>>syscjm@ayato:~$ grep "xx^x" << EOF
>>>> > xxx^
>>>> > ^xxxx
>>>> > xxaxx^xb
>>>> > xx^xstuff
>>>> > now is the time
>>>> > for all xx^x
>>>> > EOF
>>>>xxaxx^xb
>>>>xx^xstuff
>>>>for all xx^x
>>>>syscjm@ayato:~$
>>>>
>>>>
>>>>Certainly seems to work fine to me. Perhaps you could be
>>>>more specific about your problems.
>>>
>>>
>>> I tried the command you provided on three different machines and I get a
>>> different output (no output at all). Would you mind trying it on another
>>> machine as well?
>>>
>>> I also downloaded a vanilla version of GNU grep 2.5.1 and I'm getting the
>>> same result.
>>>
>>> [mentz@baobab src]$ ./grep "xx^x" << EOF
>>>
>>>>xx^x
>>>>EOF
>>>
>>> [mentz@baobab src]$
>>>
>>
>> My test above was done on a Debian box with a fairly up-to-date Etch
>> distribution, using GNU grep 2.5.1 and GNU bash 3.1.14(1)-release.
>> A test on a Solaris 10 box with up-to-date patches, using Solaris grep
>> (both /usr/bin/grep and /usr/xpg4/bin/grep) and ksh (M-11/16/88i)
>> produced the same successful results. At the moment, to me, it looks
>> to me like a bug in GNU grep that Debian patched.
>>
>>
>> Chris Mattern
>
> On a Aix 4.3.3 ksh: just FYI,
> $ more go
> echo "A"
> grep "xx^x" << EOF
> xxx^
> ^xxxx
> xxaxx^xb
> xx^xsstuff
> now is the time
> for all xx^x
> EOF
>
> $
> $ ksh go
> A
> xxaxx^xb
> xx^xsstuff
> for all xx^x
>
> JB
I just compiled the CVS version of GNU grep and it works fine with it. So I
guess it's a bug which is fixed in the CVS version.
Daniel
|