bug-grep
[Top][All Lists]
Advanced

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

Problem with regular expression using grep -E


From: Joey Officer
Subject: Problem with regular expression using grep -E
Date: Thu, 5 Jul 2007 14:31:00 -0500

I think I have found a bug in grep's usage of regular expressions, or
possibly an error in my regular expression although I have checked and
rechecked my expression.

I process the following command:

zcat -c logfile.gz | grep -E -f searchIP.txt >> filteredIPs.log

searchIP.txt:
10\.61\.98\.(6[4-9]|[7-9][0-9]|1([0-1][0-9]|2[0-7]))
10\.61\.97\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))
10\.61\.98\.([0-9]|[1-5][0-9]|6[0-3])

the above regular expression should return all IP ranges for 10.61.98.64through
10.61.98.127 (line1) 10.61.97.0 through 10.61.97.255 (line2) and
10.61.98.0through
10.61.98.0 through 10.61.98.63 (line3).

When I review the results of filteredIPs.log I see IP address that fall
outside of those ranges.  For example, I see 10.61.98.230 listed in the
result sets, which should be excluded.

The following may or may not be useful information:

$ uname -a
CYGWIN_NT-5.2 bkfnocbcr1 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin

$ grep --version
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ zcat --version
gzip 1.3.12
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.


reply via email to

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