[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grep Curly Braces aren't working
From: |
Seth David Schoen |
Subject: |
Re: Grep Curly Braces aren't working |
Date: |
Tue, 26 Jun 2012 20:32:48 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Shaner Yo writes:
> Hello,
>
> I'm starting to use cygwin with grep command. Using curly braces with a
> regex pattern is not working, even when I escape it. What am I doing
> wrong?
Hi,
The curly braces are part of extended regular extension (ERE) syntax,
not basic regular expression (BRE) syntax. The "grep" program assumes
BRE syntax, while the "egrep" program assumes ERE syntax. So you want
to use egrep, like
egrep '0{4}'
Also, you should probably use quotes around your regular expressions
(as a simpler alternative to escaping symbols), so that your shell
doesn't interpret the curly braces or other punctuation inside the
regular expression specially.
--
Seth David Schoen <address@hidden> | No haiku patents
http://www.loyalty.org/~schoen/ | means I've no incentive to
FD9A6AA28193A9F03D4BF4ADC11B36DC9C7DD150 | -- Don Marti