bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep bug? or wrong functionality?


From: Paul Jarc
Subject: Re: grep bug? or wrong functionality?
Date: Wed, 22 Jan 2003 13:21:48 -0500
User-agent: Gnus/5.090011 (Oort Gnus v0.11) Emacs/21.2 (i686-pc-linux-gnu)

"Subhakar Burri" <address@hidden> wrote:
> url2:#ROOT#:/apps/ctr/tables> cat /tmp/chaz
> 010103
> 010903
> 011103
>
> url2:#ROOT#:/apps/ctr/tables> cat /tmp/chaz | egrep 010?03
> 010103
>
> (should have matched "010903" as well)

No, the result is correct.  egrep uses regular expressions, not shell
wildcards.  You should use "." instead of "?" to get what you want.

> url2:#ROOT#:/apps/ctr/tables> cat /tmp/chaz | egrep 01*03

Use ".*" instead of "*".

You should also quote command-line arguments containing shell
wildcards.  Otherwise, the shell will replace the argument with a list
of filenames matching that pattern, and grep will use the first
filename as a regular expression.


paul




reply via email to

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