Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Wed, 9 Oct 2002 19:24:18 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: smckeown AT mac DOT com cc: cygwin AT cygwin DOT com Subject: Re: grep -i -R path32 * vs grep -i -R path32 *.vb* In-Reply-To: <20021009225234.76048.qmail@web40510.mail.yahoo.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 9 Oct 2002, Sheryl McKeown wrote: > Better titled, "That dot thing again on Windows XP > Pro..." > > Ok, again I'm trying to search recursively through a > directory structure looking for specific values. > > According to grep --help grep -R should walk the > directory structure. Cool. > > So, "grep -i -R path32 *" returns, as expected, > .grep -i -R path32 * > IntelliLab/IntelliLab.vbp:Path32="..Build" > IntelliLab/IntelliLabR.vbp:Path32="..BUILD" > IntelliLab/intellilabr.vbpold:Path32="Build" > LabTestMnt/LabTestMnt.vbp:Path32="..BUILD" > Ordent/ordent.vbp:Path32="..BUILD" > QC/qc.vbp:Path32="..BUILD" > Reports/Reports.vbp:Path32="..BUILD" > RsltsEnt/RsltsEnt.vbp:Path32="..BUILD" > RsltsInqry/ptresinq.vbp:Path32="..BUILD" > > But I want to search only files with a specific > extension. Enter the dot thing. So I try > grep -i -R path32 *.vb* > which returns nothing. > > I understand that the directories, technically, do not > have a . in the name, therefore they won't be > searched. The same reason grep -i -R path32 *.* > returns nothing. > > So the question becomes, how do I grep a directory > structure and search only files with a specific name. > (I prefere a grep only solution vs "find . -name > "somefilename" -exec ...). > > Thanks, > Sheryl Sheryl, This isn't a "dot problem". This is a grep usage problem. Frankly, I don't see why you are so opposed to 'find'... 'find . -name \*.vb\* -exec grep -ni path32 {} \; -print' can be a very powerful tool. If you want the filenames printed before the matches (ala 'grep -R'), consider using 'find . -name \*.vb\* -print | xargs grep -i path32'. If you have files with spaces and weird characters, try 'find . -name \*.vb\* -print0 | xargs -0 grep -i path32'. Of course, if you really want to stick with "pure grep", you could always do 'grep -i -R path32 --include=\*.vb\*' (now that I've pitched in an argument in favor of "find" :-D)... 'info grep' should also be quite helpful. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51 -- 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/