From: Bob Harris <harris@zk3.dec.com>
Subject: Re: Searching for text in a file
Date: Tue, 29 May 2001 16:54:08 -0400 [thread overview]
Message-ID: <290520011654086821%harris@zk3.dec.com> (raw)
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <3b13fcaa@nubby2.>, Aaron Banks <banks45@yahoo.com> wrote:
X This may be simple. I want to search for a certain text string in all files
X on my system. How do I do that?
write a simple script:
#!/bin/ksh
find starting_directory -type f -print | while read file
do
if grep -q "search string" $file
then
echo $file
fi
done
Modify the script as needed. This script will start searching in
whatever directory you substitue for 'starting_directory', and will
grep each regular file looking for "search string" as specified by you.
If it finds a file that includes the string, it will display the name
of the file where it was found.
Bob Harris
next reply other threads:[~2001-05-29 20:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-29 20:54 Bob Harris [this message]
[not found] <3b13fcaa@nubby2.>
2001-05-29 20:38 ` Searching for text in a file Stuart R. Fuller
2001-05-29 20:38 ` Stuart R. Fuller
2001-05-30 17:22 ` Mario Stargard
2001-05-30 6:24 ` Michael Heiming
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