recently introduced egrep problem
Mark J. Reed
markjreed@gmail.com
Tue Oct 14 15:21:00 GMT 2008
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@gmail.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/
More information about the Cygwin
mailing list