delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/28/16:13:30

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: "Daniel Einspanjer" <deinspanjer AT gmail DOT com>
Subject: Re: Problem with grep -Fwf (version 2.5.1a-1 and 2.5.1a-2)
Date: Fri, 28 Jul 2006 16:12:24 -0400
Lines: 68
Message-ID: <eadr3b$o85$1@sea.gmane.org>
References: <eadiub$tfs$1 AT sea DOT gmane DOT org> <20060728190502 DOT GA8071 AT trixie DOT casa DOT cgf DOT cx>
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I'm sorry, the message appeared to be formatted properly when I posted it 
but something must have happened during transmission.  Each file should have 
three lines. the data file has abc, def, and ghi.  The filter file has abc, 
de, and ghi.  The de line is significant to test the -w whole word matching 
flag.
I appreciate your looking at this and I'm sorry for the confusion.  Could 
you try it again with the files the way I just described and see if you 
might be able to reproduce the problem?

===== data.txt =====
abc
def
ghi
==========
===== filter.txt =====
abc
de
ghi
==========

Daniel

"Christopher Faylor" <cgf-no-personal-reply-please AT cygwin DOT com> wrote in 
message news:20060728190502 DOT GA8071 AT trixie DOT casa DOT cgf DOT cx...
> 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019