delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/08/08/04:24:40

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <50213AE5.5010206@gmail.com>
References: <34266659 DOT post AT talk DOT nabble DOT com> <50213AE5 DOT 5010206 AT gmail DOT com>
Date: Wed, 8 Aug 2012 09:24:13 +0100
Message-ID: <CAHWeT-Z3Kx7c+hrLYo7-8krJJQuL-z9yLtNyoEdkH5tGZT+nyA@mail.gmail.com>
Subject: Re: problem using recursive grep (-r option)
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
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 7 August 2012 16:57, marco atzeri wrote:
> On 8/7/2012 5:08 PM, AngusC wrote:
>>
>>
>> If I use the command:
>>
>> grep -nH -r "my pattern" *.*
>>
>> I get results back as expected
>>
>> But if the file pattern is like this:
>>
>> grep -nH -r "my pattern" *.log
>>
>> I get no results back (Even though I have a ton of files with this pattern
>> with .log file extension).
>>
>> Am I doing something wrong?
>>
>
> in the second case the "-r" is looking for *.log
> file or directories and I guess the directory does not match.
>
> Try
>
> find . -name "*.log" -exec grep -nH "my pattern" \{\} \;

Or have a look at grep's --include option.

Andy

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