delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/06/04/13:44:18

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 4 Jun 2009 13:43:52 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: grep -f option is not working in release of grep (2.5.3-1)
Message-ID: <20090604174352.GA753@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3046a3400906040003iaf36181i691a35e115d4524a AT mail DOT gmail DOT com> <0105D5C1E0353146B1B222348B0411A201BCE5EB42 AT NIHMLBX02 DOT nih DOT gov>
MIME-Version: 1.0
In-Reply-To: <0105D5C1E0353146B1B222348B0411A201BCE5EB42@NIHMLBX02.nih.gov>
User-Agent: Mutt/1.5.19 (2009-01-05)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Thu, Jun 04, 2009 at 12:13:08PM -0400, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>Tulasi Ram wrote on Thursday, June 04, 2009 3:04 AM:
>> In the latest release of grep (2.5.3-1), the -f option (read search
>> patters from a file) is not working for me. I have tried to search by
>> providing pattern file. 
>> 
>> I have tried by using below command. It didn?t work.
>> 
>> grep -F -B 10 -A 0 -f FindDeploymentErrors_Error.txt CM_Setup2.log
>
>If your patterns end with "$" to anchor to the end of a line, and one
>file has DOS/Windows line endings (\r\n) while the other has unix line
>endings (\n), the patterns will not match.
>
>See what the following says.
>$ file DeploymentErrors_Error.txt CM_Setup2.log

That wouldn't precisely be an issue when using the -F option:

-F, --fixed-strings
    Interpret PATTERN as a list of fixed strings, separated by newlines,
    any of which is to be matched.  (-F is specified by POSIX.)

However, it is a good point nonetheless since, if the .txt file contains
\r\n line endings the \r may be interpreted incorrectly.

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