This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: grep and the -f switch
- From: Greg Chicares <gchicares at sbcglobal dot net>
- To: cygwin at cygwin dot com
- Date: Mon, 26 Nov 2012 19:20:41 +0000
- Subject: Re: grep and the -f switch
- References: <ogf7b89pd41ok64j5lcc2emvh3d7rg097k@4ax.com>
On 2012-11-26 19:08Z, Roy Jensen wrote:
> I've created a text file (in Windows) with the text patterns I wish to
> search for. Using the -f switch, grep only searches for the last
> pattern in the file. If there is a blank line at the end, grep finds
> nothing.
>
> grep -a -A 4 -f pattern.txt my.file > output.txt
In case the file of patterns contains a carriage return, try:
d2u pattern.txt
then repeat the 'grep' command.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple