[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A few questions

kc5vxy@juno.com (Kevin J Poorman) writes:

> 1: I have a text file that in of itself is a list of files. I would like
> to take that list and grep though them to find a string. I think this can
> be done with a shell script (Bash) but I have know idea how. Can anyone
> give me some pointers and or post a script ? ... TIA

use the command grep when ou want to grep ;-)

man grep 
will you tell more about it.
> 2: The purpose of the above question is to find a file that has a string
> (IE search all the files on the hard drive for the string "foo" and list
> the files that have foo in it) Now that I know what file has "foo" in it
> I need to log all the programs that write to this file ?
> eg. program foobar and program foobarx both write to text file
> /usr/lib/cows I need to know what program is writing to that file and
> when

grep -n "foo" /*
search root path

grep -n "foo" /*/*
the next deeper one and so on

the option -n only listen the files containing "foo"

dpkg -S foo

listen all Packages that contains a file foo -> you hopefully know who is using
the file (and with this command there's no need for the above grep)

Hope it helps

Christian Leutloff, Aachen, Germany
   eMail: leutloff@sundancer.oche.de   http://www.oche.de/~leutloff/

Debian/GNU Linux! Mehr unter http://www.debian.org/

Attachment: pgpfNLqSTldeG.pgp
Description: PGP signature

Reply to: