This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: recursive grep


Brendan Simon wrote:
> 
> Christopher Jones wrote:
> 
> > > The UNIXy way to do this is
> > >
> > > find | xargs grep <pattern>
> > >

This is the proper way 

> >
> > or find -exec grep <pattern> \{\} \; -print
> >
> > proving once again there is more than one way to do just about anything.

This one will not list file names when match is found

> 
> I use
> grep pattern `find`
> or
> grep pattern `find . -name "*.c"`
> 
> This sometimes can fill the command line up though for large file matches.

The xargs above is exactly to avoid line overflow

================

I have following aliases in my .tcshrc. Make your own to taste:

alias findc 'find . -type f -name \*.\[cC\]\* -print | xargs grep'
alias findf .....


"findc <pattern>" searches for pattern in all source files in the subtree, skipping
softlinks.

> 
> Brendan Simon.
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

-- 
Tadeusz
:: The public opinion should be alarmed by its own nonexistence
:: (512)467-0618 ext. 526 ::       Stanislaw J. Lec, trans. TJL

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]