This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Problem with grep -Fwf (version 2.5.1a-1 and 2.5.1a-2)
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 28 Jul 2006 15:05:02 -0400
- Subject: Re: Problem with grep -Fwf (version 2.5.1a-1 and 2.5.1a-2)
- References: <eadiub$tfs$1@sea.gmane.org>
- Reply-to: cygwin at cygwin dot com
On Fri, Jul 28, 2006 at 01:53:32PM -0400, Daniel Einspanjer wrote:
>Using the following files both of which had dos2unix run on them to be sure
>there were no line-ending issues:
>
>===== data.txt =======
>abc
>defghi
^
>======================
>
>===== filter.txt =====
>abc
>deghi
>======================
>
>These commands work as expected:
>$ fgrep -f filter.txt data.txt
>$ tail -1 data.txt | fgrep -wf filter.txt
>
>But this command fails to return ghi:
>$ fgrep -wf filter.txt data.txt
>So it seems that after a match is discarded because it is not a full word
>(due to the -w flag), subsequent full word matches are also discarded.
Maybe it's a typo in your simplified test case but fgrep -w shouldn't match
defghi since the input is deghi.
>I've tested this with the grep 2.5.1 installed on a recent Gentoo GNU/Linux
>machine and it behaves properly so I am guessing it might be a problem
>specific to the cygwin port.
I tried this test on Cygwin, Gentoo, and FC5 and got consistent results
on all. If I remove the 'f' in defghi from data.txt then it also works
consistently on all three systems, i.e., it returns:
abc
deghi
cgf
--
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/