[wplug] need help with command

Mark Dalrymple wplug at badgertronics.com
Thu Sep 11 13:37:05 EDT 2003


> I was man'n in the wrong place: find

Find will work too, if you're on a platform that
doesn't support grep -R.

% cd directory
% find . -type f -exec grep "*stuff*" {} \; -print

and here it is broken down:

find .   : start looking in this directory, and any subdirectories
-type f  : match files, as opposed to directories
-exec    : for each file, run this command
grep "*stuff*" {} : the {} gets expanded to the file 'find' is looking at
\;       : end of the command.  the backslash keeps the shell from
           eating the semicolon
-print   : show the matching file names

Do it a couple of hundred times, and it becomes
second nature :-)

++Mark Dalrymple, markd at badgertronics.com.  http://badgertronics.com
   "Evil people live happier lives, they make more money, and they get
    all the good tax breaks"
    -- Jeff Vogel



More information about the wplug mailing list