Re: find a file
Mon, 06 Aug 2007 08:49:16 -0400
On Mon, 2007-08-06 at 08:44 -0400, Nils Kassube wrote:
> John Dangler wrote:
> > find -name "searchterm" /
> > Will search the entire drive for files...
> Make that
> find / -name "searchterm"
> because the path needs to precede other options.
Oops - Right again, Nils. I typed that from my Blackberry in the car
this morning on my way to work...
> > As to the secondary question regarding grep, to find a specific word
> > a file (or files) in a directory, I usually do this little shell
> > script, typed at the commandline- for word in `ls`
> > do
> > cat $word | grep "searchword"
> > done
> > That will search each file in a directory and tell you which files
> > the word you want (if any)
> You can use grep alone:
> grep -re "searchword" *
> or if you only want to list the filenames:
> grep -lre "searchword" *
Very nice. I need to do a bit of reading up on grep! I've been typing
short shell scripts for years to do stuff like this...
> ubuntu-users mailing list
> Modify settings or unsubscribe at:
Secure Services Engineer II
786 871 2352 (Office)
786 219 9865 (Mobile)
ubuntu-users mailing list
Modify settings or unsubscribe at: