Re: grep: BRE with caret
Daniel Mentz wrote:
> I have some problems with grep and BRE (Basic Regular Expressions).
> According to my documentation, a caret which is not the first character in
> a BRE matches a literal caret.
>
> The following command should find all lines containing "xx^x":
> grep "xx^x"
>
> But it doesn't match lines containing "xx^x".
>
> Whereas
> grep ".x^x"
> works fine. It matches "xx^x"
>
> Could somebody explain to me why the first command isn't working as
> expected.
> I'm using grep (GNU grep) 2.5.1
>
> Thanks for your
> Daniel Mentz
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.
Chris Mattern
|