wml@sei.cmu.edu (Walter Lamia) (03/22/91)
I would like to use the `search' (which uses `pick' command, right?) to find messages in multiple folders, particularly with the -after switch, so I can find all the messages that I filed recently, in any of my folders. Is there a way to do this neatly? -- Walter Lamia Voice: 412-268-3443 Software Engineering Inst. Internet: wml@sei.cmu.edu FAX: 412-268-5758 Carnegie Mellon University Usenet: ...!decwrl!sei.cmu.edu!wml Pittsburgh, PA 15213-3890
ziegast@ENG.UMD.EDU (Eric Ziegast) (03/23/91)
Walter Lamia writes: > >I would like to use the `search' (which uses `pick' command, right?) to >find messages in multiple folders, particularly with the -after switch, >so I can find all the messages that I filed recently, in any of my >folders. > >Is there a way to do this neatly? There are two ways I can think of: 1. Write a script that take multiple folder arguments and does the "pick" on each one. 2. Use slocal and send messages through a filter before using rcvstore. This filter could record (in the order you receive them) a little info about each message and append it to a file. You can later use "grep" and "tail" on it to look for specific messages. I made something like this, but it's pretty kludgy and specific as to what kind of mail I get. In both cases, you're writing a script of some sort. :-( If you enjoy writing scripts, --> :-) ________________________________________________________________________ Eric W. Ziegast, University of Merryland, Engineering Computing Services ziegast@eng.umd.edu - Eric@(301.405.3689)
jerry@ORA.ORA.COM (Jerry Peek) (03/24/91)
On 22 Mar 91 14:58:55 GMT, Walter Lamia <wml@sei.cmu.edu> wrote: > I would like to use the `search' (which uses `pick' command, right?) to find > messages in multiple folders, particularly with the -after switch, so I can > find all the messages that I filed recently, in any of my folders. This sounds like a job for a shell loop. You can type it at a shell prompt on your terminal. You don't say what you want to do with the messages you find, so let's store them in a sequence named "picked" in each folder... that way, MH will remember what messages you found in each folder. Here are examples for both the Bourne/Korn and C shells. If you have sub-folders, add "-recurse" to each "folders" command: SH/KSH CSH $ for f in `folders -fast` % foreach f (`folders -fast`) > do pick +$f -after xxx -seq picked ? pick +$f -after xxx -seq picked > done ? end Now let's get a little fancier and scan the messages you found in each folder, too -- but only if pick found some messages that match. To do that, test pick's exit status and only scan when it's zero: $ for f in `folders -fast` % foreach f (`folders -fast`) > do ? if ({ pick +$f -af xxx -seq picked }) then > if pick +$f -af xxx -seq picked ? echo ====== $f ====== > then ? scan picked > echo ====== $f ====== ? endif > scan picked ? end > fi > done Finally, to make "pick" quiet (not print "1 hit" or "No messages match specification"), just redirect its standard output and standard error: pick .... > /dev/null 2>&1 pick ... >& /dev/null --Jerry Peek, jerry@ora.com, uunet!ora!jerry
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (03/26/91)
An alternative technique is to have every message linked into an archive folder. Then you can just search through archive. This takes just a few bytes per message (for the archive directory) and can save a lot of time. ---Dan