[mew-int 01079] Re: Using GREP to Search Subfolders
David A. Panariti
davep at example.com
Mon Sep 9 23:12:08 JST 2002
Hi,
I can think of three ways OTTOMH:
1) find <dir> -type f -print0 | xargs -0 grep -n <pattern>
This is actually a builtin command in xemacs,
M-x grep-find
2) Use a text indexer. I use namazu. I index every night and namazu
comes with a contributed namzu.el that allows for very nice
searching within [X]emacs.
http://www.namazu.org
Since the index is only updated nightly, you can use #1 for the
current day's mail.
3) I've also added some lisp code to use agrep:
AGREP(l) AGREP(l)
NAME
agrep - search a file for a string or regular expression,
with approximate matching capabilities
SYNOPSIS
agrep [ -#cdehiklnpstvwxBDGIS ] pattern [ -f patternfile ]
[ filename... ]
I use the prefix arg to specify the number of mismatches
agrep allows. I can post this code if you're interested.
(It currently only works on the current folder, however.)
This'll need agrep:
ftp://ftp.cs.arizona.edu/agrep/
davep
>>>>> "Chuck" == Charles Muller <acmuller at example.com> writes:
Chuck> The structure of my Mew-Mail directories is such that I
Chuck> have a folder named from/ under which I have many
Chuck> sub-directories for various types of correspondence.
Chuck> I have been successful with using the Grep tool to search
Chuck> for strings within one directory, for example, if I do
Chuck> grep -n -e XML *
Chuck> while I am in the folder "from/tei" I can turn up all
Chuck> strings with "XML". But what I would like to use Grep for
Chuck> most of all is to find a message when I can't remember
Chuck> where I filed it under the "from" folder. In other words,
Chuck> I want to search for a string in all sub-folders under
Chuck> "from".
Chuck> I tried adding the -d switch, and -r switch, but in both
Chuck> cases, the search turns up nothing. Can someone offer any
Chuck> advice on how to do this?
More information about the Mew-int
mailing list