www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/14/11:21:27

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <f60fe000810140820k67d65409m5dc5f42f394bd633@mail.gmail.com>
Date: Tue, 14 Oct 2008 11:20:43 -0400
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: recently introduced egrep problem
In-Reply-To: <20081014113507.GR9289@calimero.vinschen.de>
MIME-Version: 1.0
References: <63fec1650810140416y3092fcccg54b274b6777b66aa AT mail DOT gmail DOT com> <20081014113507 DOT GR9289 AT calimero DOT vinschen DOT de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Oct 14 07:16, rick lavery wrote:
> Up until a recent release of grep I could execute this command in
> cygwin and it worked without any problems.
>
> echo 20081013193545 | egrep -Eo '[0-9]{1,2}'

As Corinna pointed out, the command "egrep -E" is redundant, since
"grep -E" is just GNUese for "egrep".  Use either "grep -Eo" or "egrep
-o" instead.  The same logic applies to "fgrep" and "grep -F".
(Arguably, "egrep" is more portable than "grep -E", since it works on
non-GNU versions - and despite the deprecation warnings, I imagine
"egrep" and "fgrep" are far too ingrained in far too many shell
scripts ever to be removed outright - but the "-o" option is pure GNU
anyway.)

> This same command still works on other distributions such as centos,
> rhel4, rhel5, fedora core 9, etc.

It just depends on the version of GNU grep.  In 2.5.1, egrep -E is
allowed; in 2.5.3, it's not. (I'm not sure about 2.5.2).  So, yes, it
works on RHEL5, which comes with 2.5.1, but not in, say, Ubuntu
8.04LTS, which comes with 2.5.3.

-- 
Mark J. Reed <markjreed AT gmail DOT com>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019