From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078615810300.tru64-unix-managers.marc@archive.invalid> From: Paul Key Date: Fri, 08 Aug 1997 10:04:44 +0000 To: tru64-unix-managers Subject: SUMMARY: Searching all files X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078615810300 I have been inundated with responses to this question...thanks everybody - too numerous to mention all your names. There are so many ways to crack a nut! Here are a few of the responses: ################################################### >From "Richard L Jackson Jr" For example you want to search all files for the word fubar... find / -type f -print -exec fgrep fubar '{}' \; >& /tmp/find.fubar This says start searching from root, look at only files (not directories), print searched filenames, execute fgrep for fubar, and send the results to /tmp/find.fubar. Finally, when find ends, scan the /tmp/find.fubar for fubar and note the filenames it was found in. -- Regards, Richard Jackson Computer Center Lead Engineer Mgr, Central Systems & Dept. UNIX Consulting University Computing & Information Systems (UCIS) George Mason University, Fairfax, Virginia ################################################### try this: cd / find . -print -exec grep 'string' {} \; -- Gary Jarrell | 1-800-354-9000 x30374 Digital UNIX Technology Group | MailStop: ALF1-3/Q28 Digital Equipment Corporation | E-Mail: jarrell@alf.dec.com 5555 Windward Parkway West | Alpharetta, GA 30201-7407 ################################################### Jie Gao , Matthew Norcross and Tom Webster sent in PERL scripts that do the job...I have yet to find the time to try them out! And one shell script from Dan West I use the following shell script to search all files below the current directory for a string #!/bin/sh if test $# -eq 0 then echo "Usage: search string" exit fi echo "find . -type f -print | xargs fgrep $1 /dev/null" find . -type f -print | xargs fgrep $1 /dev/null ################################################### Thanks again for the response! Paul _____________________________________________________________________ |R| A Message from Paul Key: Reginet Systems Developer |E| at |G| The Institute of Public & Environmental Health, |I| The University of Birmingham, |N| http://www.hsrc.org.uk |E| E-mail : Paul@hsrc.org.uk |T| Telephone : 0 (+44) 121 456 5600 Ext. 59876 | | Fax / Messages : 0 (+44) 121 454 6876 ______________________________________________________________________