Versions of pick: Repeatable Custom Searches

[previous] [next] [table of contents] [index]

Do you do the same pick search often? For instance, you might get messages from system programs with the word "system error" in their Subject: fields. An MH command version called (for example) pickerrs can find these messages, starting from the current message to the last message in the folder, save their numbers in a sequence named errors, and zero out the previous contents of that sequence (assuming that you've already handled the previous errors). Or you might make a whole series of pick command versions called pick-sun-errs, pick-win95-errs, and so on. That's a hypothetical situation, of course, but it shows what you can do.

To make pickerrs as a version of pick, see the Section Making a New Command Version. To make an alias or function, see the Section Writing Command Versions as Aliases or Functions.

Add an entry similar to the following to your MH profile, or add the arguments to your alias or function.

pickerrs: -subject system.error -sequence errors -list -zero cur-last
The MH profile entry above shows one weakness of making pickerrs as an MH command version: Because a shell doesn't read the MH profile, you can't use shell quoting to keep multiple-word search patterns together. I used a dot (.), a regular expression for "any character", to join the words. An alias or shell function would probably be easier in cases like this.

[Table of Contents] [Index] [Previous: Fast Folder Changes with fo] [Next: Chapter Introduction: MH Formatting]

Last change $Date: 1999/10/10 05:14:05 $

This file first appeared in the updated online edition of the book MH & nmh: Email for Users & Programmers, by Jerry Peek. Copyright © 1997 by Jerry Peek. This file is freely available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <>