From: AngusC <anguscomber@gmail.com>
To: cygwin@cygwin.com
Subject: Re: problem using recursive grep (-r option)
Date: Wed, 08 Aug 2012 09:18:00 -0000 [thread overview]
Message-ID: <34270643.post@talk.nabble.com> (raw)
In-Reply-To: <CAM7SfR2UneeDR+Np59MAhR8opFzcEUVceYKe0xxLi=-8riw53g@mail.gmail.com>
I did try the --include way but in Cygwin it didn't work for some reason.
Neither does
find "." -name "*.log" -exec grep -nH "my pattern" {} \;
or
find "." -name "*.log" | grep -nH "my pattern"
So struggling about on Cygwin at the moment.
Sean Daley-2 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
>
>
>
--
View this message in context: http://old.nabble.com/problem-using-recursive-grep-%28-r-option%29-tp34266659p34270643.html
Sent from the Cygwin list mailing list archive at Nabble.com.
--
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
next prev parent reply other threads:[~2012-08-08 9:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 15:08 AngusC
2012-08-07 15:57 ` Adam Dinwoodie
2012-08-07 16:35 ` marco atzeri
2012-08-07 17:19 ` AngusC
2012-08-07 17:32 ` marco atzeri
2012-08-08 9:11 ` Andy Koppe
2012-08-08 9:24 ` AngusC
2012-08-09 6:58 ` Andrey Repin
2012-08-09 15:30 ` Larry Hall (Cygwin)
2012-08-07 18:18 ` Sean Daley
2012-08-08 8:24 ` ping
2012-08-08 9:18 ` AngusC [this message]
2012-08-08 10:03 ` marco atzeri
2012-08-08 16:58 ` Gary Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34270643.post@talk.nabble.com \
--to=anguscomber@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).