Date: Sun, 9 Mar 1997 18:10:20 +0200 (IST) From: Eli Zaretskii To: sysdev AT mb DOT sympatico DOT ca cc: djgpp AT delorie DOT com Subject: Re: Search DOS hard drive question In-Reply-To: <199703072306.SAA08843@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 7 Mar 1997, DJ Delorie wrote: > > I want to search all files on the hard > > drive for a specific character string; > > in the root directory, and all subdirectories. > > ALL files. > > If you have a version of grep built with DJGPP Version 2 > (v2gnu/grep20b.zip), the answer is *really* simple: > > grep "mystring" .../* This will work, but has two drawbacks: 1) It prints an error message about every directory it encounters. 2) If you happen to have a binary file which includes "mystring", the ``line'' printed to the screen can garble the entire screen. Therefore, I suggest using the following command instead: find / ! -type d -exec grep -q "mystring" {} ; -print The `-q' switch caused `grep' to only report whether the file contains the string via its exit status, rather than printing the line with that string. If you want to exclude executable programs, say this: find / ! -type d -exec ! -perm 0755 grep -q "mystring" {} ; -print `find' is part of GNU Findutils (v2gnu/find41b.zip).