X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-5.4 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: <5021D292.4030709@gmail.com> Date: Tue, 07 Aug 2012 22:44:34 -0400 From: ping User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: problem using recursive grep (-r option) References: <34266659 DOT post AT talk DOT nabble DOT com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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 8/7/2012 1:55 PM, Sean Daley wrote: > 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 > I think this is the best answer ever so far. also it looks for me: grep -nHr "pattern" *.* equals: grep -nHr "pattern" . I use the latter alot to quickly locate a file per content. -- 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