delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/11/26/15:15:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED
X-Spam-Check-By: sourceware.org
From: Roy Jensen <R DOT Jensen AT consol DOT ca>
To: cygwin AT cygwin DOT com
Subject: Re: grep and the -f switch
Date: Mon, 26 Nov 2012 13:15:26 -0700
Message-ID: <bbj7b8pl79jrbfhi3f8crgal1nqv0jmos8@4ax.com>
References: <ogf7b89pd41ok64j5lcc2emvh3d7rg097k AT 4ax DOT com>
In-Reply-To: <ogf7b89pd41ok64j5lcc2emvh3d7rg097k@4ax.com>
MIME-Version: 1.0
X-Get-Message-Sender-Via: cs2.uhcloud.com: authenticated_id: r DOT jensen AT consol DOT ca
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id qAQKFlCt018457

The issue is the text format. Windows is \r\n; Unix is \n.
I used Notepad++ to save in Unix text format and everything worked
fine.

Sigh...should have thought of that before. 

Roy Jensen
	-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	*** Imagination is more important than knowledge. (Einstein)
	=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


On Mon, 26 Nov 2012 12:08:54 -0700, you 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
>
>Any suggestions to get this to work?
>
>Thanks,
>Roy Jensen
>
>Roy Jensen
>	-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>	*** Imagination is more important than knowledge. (Einstein)
>	=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019