[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bugs about grep
From: |
杨华 |
Subject: |
bugs about grep |
Date: |
Thu, 08 Jul 2004 10:52:58 +0800 |
Hi :
I got a file abc :
--------
ACCEPT all -- 10.1.3.68 0.0.0.0/0
ACCEPT all -- 10.1.3.39 0.0.0.0/0 MAC
00:B9:00:00:87:26
ACCEPT all -- 10.1.3.3 0.0.0.0/0
ACCEPT all -- 10.123.3 0.0.0.0/0
DROP all -- 0.0.0.0/0 0.0.0.0/0
--------
And I want to find out the line contain "10.1.3.3" .
When I do :
#cat abc | grep -Fw 10.1.3.3
----no result .
#cat abc | grep -F 10.1.3.3 | grep -w 10.1.3.3
ACCEPT all -- 10.1.3.3 0.0.0.0/0
----give out line3 , right answer
also if I delete the first two line in abc file , the result will be
different . both the two command give out the same right answer.
#cat abc | grep -Fw 10.1.3.3
ACCEPT all -- 10.1.3.3 0.0.0.0/0
#cat abc | grep -F 10.1.3.3 | grep -w 10.1.3.3
ACCEPT all -- 10.1.3.3 0.0.0.0/0
after many retries , I found if I delete the '9' of '10.1.3.39' in line2
or change "39" to whatever not "3x" , then both command can give the
right answer.
does that means a bug ?
-----------------
by the way , I have try it on solaris , and find the same problem :
I use "cat abc | /usr/xpg4/bin/grep -Fw 10.1.3.3" also give no answer.
the solaris is "SunOS ns1 5.7 Generic_106541-02 sun4u sparc SUNW,Ultra-250"
-----------------
Regards.
Richard Young.
--
杨华 <address@hidden>