delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/02/19:54:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.1.0.14.2.20020802164940.02034228@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Fri, 02 Aug 2002 16:54:06 -0700
To: "Cliff Hones" <cliff AT aonix DOT co DOT uk>, <cygwin AT cygwin DOT com>
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Easy, quick, BASH question
In-Reply-To: <002c01c23a7e$893a8800$0101a8c0@albion>
References: <5 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20020802162547 DOT 035e9a58 AT pop3 DOT cris DOT com>
Mime-Version: 1.0

Cliff,

Yes, it's off-topic, but I see no reason to simply send people away for 
that reason when I have information that might be useful.

As to the "find" part being unnecessary, you don't know that. I assume the 
reason Kevin originally included the "find" in his attempt is that he 
wanted to grep in files (of the stipulated name patterns) in the current 
directory or anywhere beneath it. What you're suggesting will find only 
those files in the current directory.

It's also possible to use grep's (GNU grep's) -R option in combination with 
the "--include" argument to select files with the proper name pattern. In 
this case, this is probably the best way to go in terms of overhead and 
almost certainly will yield the best net performance.

Randall Schulz
Mountain View, CA USA


At 16:44 2002-08-02, Cliff Hones wrote:
> >...
> > To get anything more complicated, you must use a shell procedure. E.g.:
> >
> > hcgrep() {
> >          grep -n "$@" $(find -name '*.[ch]')
> > }
> >
> >...
>
>In this particular example, find isn't necessary.  Try:
>
>    hcgrep() { grep -n "$@" *.c *.h"; }
>
>BTW, this is really OT for this list, since it's a Bash question and not
>Cygwin-specific.
>
>-- Cliff


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019