URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=17274>
Summary: grep -Fw gives strange results
Project: grep
Submitted by: betterworld
Submitted on: Thursday 08/03/2006 at 02:17
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
_______________________________________________________
Details:
I've tried the following command on sevaral systems (each had GNU grep-2.5.1
installed):
echo -e 'blah blubb\nb' | grep -Fw b
This printed both lines ("blah blubb\nb") System 1 and System 4, whereas
Systems 2 and 3 did not print anything. However, in my opinion, the correct
output would have been "b", since this is the only line that contains b as a
word.
echo -e 'DESKTOP\nCDRW DUALXP SATA DE' | grep -Fw DE
This gave the correct output ("CDRW DUALXP SATA DE") on Systems 1 and 4, but
Systems 2 and 3 did not print anything.
Apparently, grep -Fw gets confused when encountering the search string ("b"
or "DE") within a word (like "blah" or "DESKTOP", respectively). If there
are no words that include the search string as a substring, the output is as
expected. Also, the output is as expected when you don't use -F.
The systems I tested are:
1: Gentoo Linux, GNU grep 2.5.1
2: Debian Sarge, GNU grep 2.5.1
3: Suse 9.2, GNU grep 2.5.1
4: Red Hat Enterprise Linux ES release 3, GNU grep 2.5.1
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=17274>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/