PICK(1mh)
🌸 PICK(1mh) 🌸
okay bestie, buckle up — this is pick from the nmh manual, and it's literally the search bestie you've been waiting for 💖
✨ NAME ✨
pick — search nmh messages 🔍
✨ SYNOPSIS ✨
pick [-help] [-version] [+folder] [msgs] [-reverse ...] [-and ...]
[-or ...] [-not ...] [-lbrace ... -rbrace] [--component pattern]
[-cc pattern] [-date pattern] [-from pattern] [-search pattern]
[-subject pattern] [-to pattern] [-after date] [-before date]
[-datefield field] [-sequence name ...] [-nosequence] [-public |
-nopublic] [-zero | -nozero] [-list | -nolist] [-debug]
and here's how people actually use it, the typical usage slay:
scan `pick -from jones`
pick -to holloway -sequence select
show `pick -before friday`
✨ DESCRIPTION ✨
so pick goes digging inside a folder for messages with the contents you asked for, and then it tells you which messages those are. there are two flavors of search primitives: pattern matching and date constraint operations. both. iconic.
a modified grep(1) does the actual matching, so the whole regular expression facility (peep ed(1)) is available inside pattern. with -search, your pattern gets used directly. with the others, the grep pattern it constructs is:
`component[ \t]*:.*pattern'
which means a pattern you give to -search will be found everywhere in the message — header AND body — while the other pattern-matching requests are limited to just the one component you named. no cap.
the expression
`--component pattern'
is a shorthand for specifying
`-search “component[ \t]*:.*pattern” '
and it exists so you can pick a component that isn't one of “To:”, “cc:”, “Date:”, “From:”, or “Subject:”. example: “pick --reply-to pooh”. cute right?
pattern matching happens on a per-line basis. inside the header of the message, each component is treated as one long line, but in the body, each line is separate. and the case thing: lower-case letters in the search pattern will match either lower or upper case in the message, while upper case will match only upper case. 👑
ngl this next bit trips people up: since-dateis a pattern matching operation (like described above), if you want to find messages sent on a certain date, the pattern string has to match the text of the“Date:”field of the message. text. not vibes.
independent of any pattern matching you asked for, the switches -after date or -before date can also be used to drop date/time constraints on all the messages. by default the “Date:” field is consulted, but if some other date-yielding field (like “BB-Posted:” or “Delivery-Date:”) should be used instead, the -datefield field switch is your girl.
with -before and -after, pick actually parses the date fields in each of the messages you specified in msgs and compares them to the date/time you gave. if -after is given, then only those messages whose “Date:” field value is chronologically after the date specified will be considered. the -before switch specifies the complementary action. 💅
both -after and -before take legal RFC 822-style date specifications as arguments. pick will default certain missing fields so you don't have to spell out the entire date. these fields are (in order of defaulting): timezone, time and timezone, date, date and timezone. all defaults are taken from the current date, time, and timezone. ✨
on top of RFC 822-style dates, pick will also recognize any of the days of the week (“sunday”, “monday”, and so on), and the special dates “today”, “yesterday” (24 hours ago), and “tomorrow” (24 hours from now). all days of the week are judged to refer to a day in the past (e.g., telling pick “saturday” on a “tuesday” means “last saturday” not “this saturday”). time is fake, days of the week are fake, but the manpage is real 😭
finally, in addition to all those special specifications, pick will also honor a specification of the form “-dd”, which means “dd days ago”. 🕰️
use the -reverse switch to make pick find matching messages in reverse order, working from the highest message number down to the lowest. this can be useful for searching for recent messages in large folders, for example:
pick -reverse -from frated | xargs -n1 scan
pick supports complex boolean operations on the searching primitives with the -and, -or, -not, and -lbrace ... -rbrace switches. for example:
pick -after yesterday -and
-lbrace -from freida -or -from fear -rbrace
identifies messages recently sent by “frieda” or “fear”. 🫶
the matching primitives take precedence over the -not switch, which in turn takes precedence over -and, which in turn takes precedence over -or. to override the default precedence, the -lbrace and -rbrace switches are provided — they act just like opening and closing parentheses in logical expressions. periodt.
if no search criteria are given, all the messages specified on the command line are selected (this defaults to “all”).
once the search has been performed, if the -list switch is given, the message numbers of the selected messages are written to the standard output separated by newlines. this is extremely useful for quickly generating arguments for other nmh programs by using the “backquoting” syntax of the shell. for example, the command
scan `pick +todo -after “31 Mar 83 0123 PST”`
says to scan those messages in the indicated folder which meet the appropriate criterion. note that since pick's context changes are written out prior to scan's invocation, you need not give the folder argument to scan as well. one less thing bestie 🎀
the -sequence name switch may be given once for each sequence the user wishes to define. for each sequence named, that sequence will be defined to mean exactly those messages selected by pick. for example:
pick -from frated -seq fred
defines a new message sequence for the current folder called “fred” which contains exactly those messages that were selected. obsessed.
the -nosequence switch will disable all previously named sequences, allowing those established by a profile component to be overridden. 💅
by default, pick will zero a sequence before adding it. this action can be disabled with the -nozero switch, which means that the messages selected by pick will be added to the sequence, if it already exists, and any messages already a part of that sequence will remain so. no thoughts, just accumulation.
the -public and -nopublic switches are used by pick in the same way mark uses them.
the -debug switch causes pick to output a representation of the search pattern. 🔍
🌈 Output when no messages are matched 🌈
if pick is used in a backquoted operation, such as
scan `pick -from jones`
and pick selects no messages (e.g., no messages are from “jones”), then the shell will still run the outer command (e.g., scan). since no messages were matched, pick produced no output, and the argument given to the outer command as a result of backquoting pick is empty. in the case of nmh programs, the outer command now acts as if the default msg or msgs should be used (e.g., “all” in the case of scan). to prevent this unexpected behavior, if -list was given, and if its standard output is not a tty, then pick outputs the illegal message number “0” when it fails. this lets the outer command fail gracefully as well. 💀 genuinely cursed behavior, but now you know.
✨ FILES ✨
$HOME/.mh_profile— the user profile 🏠
✨ PROFILE COMPONENTS ✨
Path:— to determine the user's nmh directoryCurrent-Folder:— to find the default current folder
✨ SEE ALSO ✨
mark(1)🫶
✨ DEFAULTS ✨
+folderdefaults to the current foldermsgsdefaults to all-datefield date-zero-listis the default if no-sequence,-nolistotherwise
✨ CONTEXT ✨
if a folder is given, it will become the current folder. main character folder energy 👑
✨ HISTORY ✨
in previous versions of MH, the pick command would show, scan, or refile the selected messages. this was rather “inverted logic” from the Unix point of view, so pick was changed to define sequences and output those sequences. hence, pick can be used to generate the arguments for all other MH commands, instead of giving pick endless switches for invoking those commands itself. glow-up fr fr 💅
also, previous versions of pick balked if you didn't specify a search string or a date/time constraint. the current version does not, and merely matches the messages you specify. this lets you type something like:
show `pick last:20 -seq fear`
instead of typing
mark -add -nozero -seq fear last:20
show fear
finally, timezones used to be ignored when comparing dates: they aren't any more. ⏰
✨ HELPFUL HINTS ✨
use “pick sequence -list” to enumerate the messages in a sequence (such as for use by a shell script). go off, shell scripter 🐚
✨ BUGS ✨
- any occurrence of
-datefieldmust occur prior to the-afteror-beforeswitch it applies to. order matters, bestie 😭 - the pattern syntax
“[l-r]”is not supported; each letter to be matched must be included within the square brackets. so type them all out, no shortcuts 🙈
and that's the whole thing!! 💖 this page came from nmh-1.8, dated 2016-03-12, and it's PICK(1mh) — go pick some messages, you got this 🦋✨
📦 where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms