1PICK(1) General Commands Manual PICK(1)
2
3
4
6 pick - search nmh messages
7
9 pick [-help] [-version] [+folder] [msgs] [-reverse ...] [-and ...]
10 [-or ...] [-not ...] [-lbrace ... -rbrace] [--component pat‐
11 tern] [-cc pattern] [-date pattern] [-from pattern] [-search pat‐
12 tern] [-subject pattern] [-to pattern] [-after date] [-before
13 date] [-datefield field] [-sequence name ...] [-nosequence]
14 [-public | -nopublic] [-zero | -nozero] [-list | -nolist] [-debug]
15
16 typical usage:
17
18 scan `pick -from jones`
19 pick -to holloway -sequence select
20 show `pick -before friday`
21
23 pick searches within a folder for messages with the specified contents,
24 and then identifies those messages. Two types of search primitives are
25 available: pattern matching and date constraint operations.
26
27 A modified grep(1) is used to perform the matching, so the full regular
28 expression (see ed(1)) facility is available within pattern. With
29 -search, pattern is used directly, and with the others, the grep pat‐
30 tern constructed is:
31
32 `component[ \t]*:.*pattern'
33
34 This means that the pattern specified for a -search will be found
35 everywhere in the message, including the header and the body, while the
36 other pattern matching requests are limited to the single specified
37 component. The expression
38
39 `--component pattern'
40
41 is a shorthand for specifying
42
43 `-search “component[ \t]*:.*pattern” '
44
45 It is used to pick a component which is not one of “To:”, “cc:”,
46 “Date:”, “From:”, or “Subject:”. An example is “pick --reply-to pooh”.
47
48 Pattern matching is performed on a per-line basis. Within the header
49 of the message, each component is treated as one long line, but in the
50 body, each line is separate. Lower-case letters in the search pattern
51 will match either lower or upper case in the message, while upper case
52 will match only upper case.
53
54 Note that since the -date switch is a pattern matching operation (as
55 described above), to find messages sent on a certain date the pattern
56 string must match the text of the “Date:” field of the message.
57
58 Independent of any pattern matching operations requested, the switches
59 -after date or -before date may also be used to introduce date/time
60 constraints on all of the messages. By default, the “Date:” field is
61 consulted, but if another date-yielding field (such as “BB-Posted:” or
62 “Delivery-Date:”) should be used, the -datefield field switch may be
63 used.
64
65 With -before and -after, pick will actually parse the date fields in
66 each of the messages specified in `msgs' and compare them to the
67 date/time specified. If -after is given, then only those messages
68 whose “Date:” field value is chronologically after the date specified
69 will be considered. The -before switch specifies the complementary
70 action.
71
72 Both the -after and -before switches take legal RFC 822-style date
73 specifications as arguments. pick will default certain missing fields
74 so that the entire date need not be specified. These fields are (in
75 order of defaulting): timezone, time and timezone, date, date and time‐
76 zone. All defaults are taken from the current date, time, and time‐
77 zone.
78
79 In addition to RFC 822-style dates, pick will also recognize any of the
80 days of the week (“sunday”, “monday”, and so on), and the special dates
81 “today”, “yesterday” (24 hours ago), and “tomorrow” (24 hours from
82 now). All days of the week are judged to refer to a day in the past
83 (e.g., telling pick “saturday” on a “tuesday” means “last saturday” not
84 “this saturday”).
85
86 Finally, in addition to these special specifications, pick will also
87 honor a specification of the form “-dd”, which means “dd days ago”.
88
89 Use the -reverse switch to make pick find matching messages in reverse
90 order, working from the highest message number down to the lowest.
91 This can be useful in searching for recent messages in large folders,
92 for example,
93
94 pick -reverse -from frated | xargs -n1 scan
95
96 pick supports complex boolean operations on the searching primitives
97 with the -and, -or, -not, and -lbrace ... -rbrace switches. For exam‐
98 ple,
99
100 pick -after yesterday -and
101 -lbrace -from freida -or -from fear -rbrace
102
103 identifies messages recently sent by “frieda” or “fear”.
104
105 The matching primitives take precedence over the -not switch, which in
106 turn takes precedence over -and which in turn takes precedence over
107 -or. To override the default precedence, the -lbrace and -rbrace
108 switches are provided, which act just like opening and closing paren‐
109 theses in logical expressions.
110
111 If no search criteria are given, all the messages specified on the com‐
112 mand line are selected (this defaults to “all”).
113
114 Once the search has been performed, if the -list switch is given, the
115 message numbers of the selected messages are written to the standard
116 output separated by newlines. This is extremely useful for quickly
117 generating arguments for other nmh programs by using the “backquoting”
118 syntax of the shell. For example, the command
119
120 scan `pick +todo -after “31 Mar 83 0123 PST”`
121
122 says to scan those messages in the indicated folder which meet the
123 appropriate criterion. Note that since pick's context changes are
124 written out prior to scan's invocation, you need not give the folder
125 argument to scan as well.
126
127 The -sequence name switch may be given once for each sequence the user
128 wishes to define. For each sequence named, that sequence will be
129 defined to mean exactly those messages selected by pick. For example,
130
131 pick -from frated -seq fred
132
133 defines a new message sequence for the current folder called “fred”
134 which contains exactly those messages that were selected.
135
136 The -nosequence switch will disable all previously named sequences,
137 allowing those established by a profile component to be overridden.
138
139 By default, pick will zero a sequence before adding it. This action
140 can be disabled with the -nozero switch, which means that the messages
141 selected by pick will be added to the sequence, if it already exists,
142 and any messages already a part of that sequence will remain so.
143
144 The -public and -nopublic switches are used by pick in the same way
145 mark uses them.
146
147 The -debug switch causes pick to output a representation of the search
148 pattern.
149
150 Output when no messages are matched
151 If pick is used in a backquoted operation, such as
152
153 scan `pick -from jones`
154
155 and pick selects no messages (e.g., no messages are from “jones”), then
156 the shell will still run the outer command (e.g., scan). Since no mes‐
157 sages were matched, pick produced no output, and the argument given to
158 the outer command as a result of backquoting pick is empty. In the
159 case of nmh programs, the outer command now acts as if the default
160 `msg' or `msgs' should be used (e.g., “all” in the case of scan). To
161 prevent this unexpected behavior, if -list was given, and if its stan‐
162 dard output is not a tty, then pick outputs the illegal message number
163 “0” when it fails. This lets the outer command fail gracefully as
164 well.
165
167 $HOME/.mh_profile The user profile
168
170 Path: To determine the user's nmh directory
171 Current-Folder: To find the default current folder
172
174 mark(1)
175
177 `+folder' defaults to the current folder
178 `msgs' defaults to all
179 `-datefield date'
180 `-zero'
181 `-list' is the default if no `-sequence', `-nolist' otherwise
182
184 If a folder is given, it will become the current folder.
185
187 In previous versions of MH, the pick command would show, scan, or
188 refile the selected messages. This was rather “inverted logic” from
189 the Unix point of view, so pick was changed to define sequences and
190 output those sequences. Hence, pick can be used to generate the argu‐
191 ments for all other MH commands, instead of giving pick endless
192 switches for invoking those commands itself.
193
194 Also, previous versions of pick balked if you didn't specify a search
195 string or a date/time constraint. The current version does not, and
196 merely matches the messages you specify. This lets you type something
197 like:
198
199 show `pick last:20 -seq fear`
200
201 instead of typing
202
203 mark -add -nozero -seq fear last:20
204 show fear
205
206 Finally, timezones used to be ignored when comparing dates: they aren't
207 any more.
208
210 Use “pick sequence -list” to enumerate the messages in a sequence (such
211 as for use by a shell script).
212
214 Any occurrence of -datefield must occur prior to the -after or -before
215 switch it applies to.
216
217 The pattern syntax “[l-r]” is not supported; each letter to be matched
218 must be included within the square brackets.
219
220
221
222nmh-1.7.1 2016-03-12 PICK(1)