bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep with file of patterns


From: John Cowan
Subject: Re: grep with file of patterns
Date: Sat, 4 Feb 2012 18:14:38 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

Eli Zaretskii scripsit:
> > From: Al Buckingham <address@hidden>
> > Date: Fri, 3 Feb 2012 14:13:56 -0500
> > 
> > Only the last pattern in the text file of patterns is processed
> >  
> > C:\cygwin>grep --fixed-strings  --file=C:\patternlist.txt  C:\code.inc > 
> > C:\GREP_OUT.txt
> > Patternlist.txt contains two lines
> > function
> > class
> > 
> > Whatever pattern appears last in the file it is the one that is processed.
> > All other patterns are ignored.
> 
> Cannot reproduce this here, but I don't have Cygwin installed.
> 
> Things to check/do:
> 
>  . upgrade to the latest Grep from Cygwin
> 
>  . make sure patternlist.txt has Unix-style LF-only end-of-line format

This is almost certainly the problem.  When I tried this under Cygwin
with a DOS-style patternlist.txt, I reproduced the behavior; when I
converted it to Unix-style, all was well.  I'd guess that the CR at the
beginning of the first line is being treated as part of the pattern.
Just why the other CR is not, is a question.

-- 
John Cowan   address@hidden
    "Mr. Lane, if you ever wish anything that I can do, all you will have
        to do will be to send me a telegram asking and it will be done."
    "Mr. Hearst, if you ever get a telegram from me asking you to do
        anything, you can put the telegram down as a forgery."



reply via email to

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