X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: Date: Tue, 14 Oct 2008 11:20:43 -0400 From: "Mark J. Reed" To: cygwin AT cygwin DOT com Subject: Re: recently introduced egrep problem In-Reply-To: <20081014113507.GR9289@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 -- 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/