X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-5.5 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
Message-ID: <50213AE5.5010206@gmail.com>
Date: Tue, 07 Aug 2012 17:57:25 +0200
From: marco atzeri <marco.atzeri@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: problem using recursive grep (-r option)
References: <34266659.post@talk.nabble.com>
In-Reply-To: <34266659.post@talk.nabble.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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" \{\} \;

Regards
Marco

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

