From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31077 invoked by alias); 7 Aug 2012 17:56:14 -0000 Received: (qmail 31057 invoked by uid 22791); 7 Aug 2012 17:56:13 -0000 X-SWARE-Spam-Status: No, hits=-4.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 Received: from mail-vc0-f171.google.com (HELO mail-vc0-f171.google.com) (209.85.220.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Aug 2012 17:55:58 +0000 Received: by vcdd16 with SMTP id d16so4694155vcd.2 for ; Tue, 07 Aug 2012 10:55:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.100.165 with SMTP id ez5mr10043641vdb.108.1344362157109; Tue, 07 Aug 2012 10:55:57 -0700 (PDT) Received: by 10.52.182.137 with HTTP; Tue, 7 Aug 2012 10:55:57 -0700 (PDT) In-Reply-To: <34266659.post@talk.nabble.com> References: <34266659.post@talk.nabble.com> Date: Tue, 07 Aug 2012 18:18:00 -0000 Message-ID: Subject: Re: problem using recursive grep (-r option) From: Sean Daley To: cygwin@cygwin.com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-08/txt/msg00176.txt.bz2 On Tue, Aug 7, 2012 at 11:08 AM, 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? > -- The first one works because *.* will match everything your current directory, including sub-directories and it will recurse through each of them. The second example will first match anything in your current directory with a .log extension and try to grep it (if it's a file) or recurse through it if it's a directory. What I believe you want to do (at least works on Linux) is grep -nH -r "my pattern" --include "*.log" . Sean -- 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