On November 30, 2005 12:30, rikona wrote:
> On Wednesday, November 30, 2005, 10:28:15 AM, Derek Jennings wrote:
>
> DJ> If Kat worked correctly it would be a nice feature, since it
> DJ> catalogues the contents of files, not just its name.
>
> Agreed, but the search tools are rather primitive. When I checked the
> kat site, all the efforts seem to be in bells and whistles, ala
> Windows, rather than developing a killer search capability. Too bad -
> it has great potential utility.

There's always the command line:

find <startdir> -name "<filenamepatttern>" -print

will give a list of all the files in or below <startdir> whose name matches 
the patter <filenamepattern>. The pattern is specified using the shell 
globbing syntax ("*" matches zero or more characters, "?" matches any single 
character), not regular expressions, which is why the double quotes are 
required (otherwise, the shell would expand the pattern before find sees it), 
unless it's a simple file name with no wildcards.

There are many other search and action options to find as well, though the 
syntax can get tricky. See the "man find" for details.

If you want to search for a text pattern within the files, you can do it like 
so:

find <startdir> -name "<filenamepattern>" -exec grep -H "<textpattern>" {} \;

which will feed the name of each file matched by find into grep. <textpattern> 
is a regular expression (see "man grep" for details), and again double quotes 
are required if it contains any "*" or "?". The -H forces grep to print the 
file name (otherwise, you'll see the match, but not know which file it was 
found in). You can use egrep for more powerful regular expressions. Or you 
can feed the find results into any other command you like - wherever the {} 
occurs, the current file name will be substituted by find. The \; is always 
required to terminate the -exec clause.

Not very user friendly, I'll admit, but it gets the job done. It might be nice 
if someone wrapped a gui around all this for the average end user.

-- 
Ron
ronhd at users dot sourceforge dot net

Opinions expressed here are all mine.
____________________________________________________
Want to buy your Pack or Services from Mandriva? 
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Reply via email to