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

Re: dir /s *.* equivalent for unix.



On Tue, 07 Jul 1998, Stephen J. Carpenter wrote:
>On Mon, Jul 06, 1998 at 08:19:36PM -0700, Christopher Barry wrote:
>> Hi all,
>> 
>> I just keeping getting all these lovely questions for you. At a console,
>> if I want to search for a file or any files with a certain extension in
>> the current directory and all sub directories and list them, what's the
>> best way to do this? The equivalent in DOS would be "dir /s *.whatever"
>> but this doesn't work with ls like "ls -R *.deb", for instance. I can do
>> "ls -R | more" and then use more's search ability but this is getting
>> tiring. Man page isn't too helpful either.
>
>man -k keyword is much more usefull ;)

How do you build the database for man -k? On the systems I've installed(RH, I'm
currently waiting for Bo to arrive) man-k wouldn't bring up any entries.

I remember way back I managed to do something on a Solaris 2.5 that created a
database that man-k searches through, but damned if I remember how I did it.

>
>3) check out: find, locate, grep
>check this out...lets say I am looking for .jpg files throughout my
>entire system:
>$ locate .jpg
>/usr/doc/dhelp/debian.jpg
>/usr/doc/info2www/infodoc.jpg

Side note:

locate uses a "database" of filenames created by updatedb, so recent additions
to your box may not show up using a locate command.

find actually does an immediate search of the filesystem, but it can take a
minute or two where a locate tosses back the results more quickly.

>now lets say I am in /usr/doc/dhelp and ONLY want ones "under" that
>directory:
>$ locate .jpg|grep `pwd`
>/usr/doc/dhelp/debian.jpg
>
>thats just my creative solution... I am sure there are many others
>(why is it I can never think of that when I actually need to 
>use it?)
>
>anyone else got some ways?
>

grep is a useful filter, but Unix has quite a few others that can be just as
useful. You might have a /usr/doc/textutils***/ directory that has a README
that explains a few of them.

For ex/

locate .jpg |  wc -l

or locate .jpg | grep 'nicole' | sort | pr -2 -h "Pictures of Nicole"


Mark





--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: