tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Paul Key <Paul () hsrc ! org ! uk>
To: tru64-unix-managers
Subject: SUMMARY: Searching all files
Date: Fri, 08 Aug 1997 10:04:44 +0000	[thread overview]
Message-ID: <96078615810300.tru64-unix-managers.marc@archive.invalid> (raw)

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" <rjackson@portal.gmu.edu>

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 <jgao@csu.EDU.AU>,  Matthew Norcross <matt@CS.Princeton.EDU> and Tom
Webster <webster@ssdpdc.mdc.com> 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 <dwest@ad3100.ada.epa.gov>

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
______________________________________________________________________ 

                 reply	other threads:[~1997-08-08 10:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox