This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: grep -f option is not working in release of grep (2.5.3-1)


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]