bug-grep
[Top][All Lists]
Advanced

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

RE: -f doesn't work?


From: John Pyrce
Subject: RE: -f doesn't work?
Date: Tue, 27 May 2008 08:53:10 -0500

Thanks for replying.  I finally found my problem:  I recently updated to
the latest version of cygwin and probably changed the choice for new
line encoding by mistake; you get prompted to choose between unix/dos
style during installation and I didn't remember what I had chosen
originally.  So apparently grep now viewed the existing pattern file
provided with "-f" as a stream of bytes with no lines, and that never
matched anything.  When I re-wrote the pattern file with a different
line return encoding, patterns again matched.  Ah well.

-----Original Message-----
From: Bob Proulx [mailto:address@hidden 
Sent: Friday, May 23, 2008 8:55 PM
To: John Pyrce
Cc: address@hidden
Subject: Re: -f doesn't work?

John Pyrce wrote:
> I installed the latest version of cygwin, and now using patterns from
a
> file via "grep -f filename" doesn't work.  It's hard to believe that
> this would be broken, but I can't see anything that I'm doing wrong
> either.  Any thoughts?

"Doesn't work" is a little vague.  Can you give us an example?  Then
we could say if it works or not.

To pre-emptively respond, -f is as the documentation says:

       -f FILE, --file=FILE
              Obtain patterns from FILE, one per line.  The  empty  file
con-
              tains zero patterns, and therefore matches nothing.

Therefore an example (using GNU syntax) would be:

  $ echo oo > patternfile
  $ echo foo > datafile
  $ grep -f patternfile datafile
  foo

You would need to adapt that for your Cygwin system but I assume you
know it better than I do since I do not know it very well.

Bob




reply via email to

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