]> diplodocus.org Git - nmh/blob - man/pick.man
Changed build_nmh sasl and tls defaults to be configure's.
[nmh] / man / pick.man
1 .TH PICK %manext1% "August 3, 2014" "%nmhversion%"
2 .\"
3 .\" %nmhwarning%
4 .\"
5 .SH NAME
6 pick \- search for messages by content
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B pick
11 .RB [ \-help ]
12 .RB [ \-version ]
13 .RI [ +folder ]
14 .RI [ msgs ]
15 .RB [ \-reverse
16 \&...]
17 .RB [ \-and
18 \&...]
19 .RB [ \-or
20 \&...]
21 .RB [ \-not
22 \&...]
23 .RB [ \-lbrace
24 \&...
25 .BR \-rbrace ]
26 .RB [ \-\|\-component
27 .IR pattern ]
28 .RB [ \-cc
29 .IR pattern ]
30 .RB [ \-date
31 .IR pattern ]
32 .RB [ \-from
33 .IR pattern ]
34 .RB [ \-search
35 .IR pattern ]
36 .RB [ \-subject
37 .IR pattern ]
38 .RB [ \-to
39 .IR pattern ]
40 .RB [ \-after
41 .IR date ]
42 .RB [ \-before
43 .IR date ]
44 .RB [ \-datefield
45 .IR field ]
46 .RB [ \-sequence
47 .I name
48 \&...]
49 .RB [ \-nosequence ]
50 .RB [ \-public " | " \-nopublic ]
51 .RB [ \-zero " | " \-nozero ]
52 .RB [ \-list " | " \-nolist ]
53 .RB [ \-debug ]
54 .PP
55 typical usage:
56 .PP
57 .RS 5
58 .nf
59 scan\0`pick\0\-from\0jones`
60 pick\0\-to\0holloway\0\-sequence\0select
61 show\0`pick\0\-before\0friday`
62 .fi
63 .RE
64 .ad
65 .SH DESCRIPTION
66 .B pick
67 searches within a folder for messages with the specified
68 contents, and then identifies those messages. Two types of search
69 primitives are available: pattern matching and date constraint
70 operations.
71 .PP
72 A modified
73 .IR grep (1)
74 is used to perform the matching, so the
75 full regular expression (see
76 .IR ed (1))
77 facility is available
78 within
79 .IR pattern .
80 With
81 .BR \-search ,
82 .I pattern
83 is used directly, and with the others, the grep pattern constructed is:
84 .PP
85 .RS 5
86 `component[ \\t]*:\&.*pattern'
87 .RE
88 .PP
89 This means that the pattern specified for a
90 .B \-search
91 will be found
92 everywhere in the message, including the header and the body, while
93 the other pattern matching requests are limited to the single specified
94 component. The expression
95 .PP
96 .RS 5
97 `\-\|\-component\ pattern'
98 .RE
99 .PP
100 is a shorthand for specifying
101 .PP
102 .RS 5
103 `\-search \*(lqcomponent[ \\t]*:\&.*pattern\*(rq\ '
104 .RE
105 .PP
106 It is used to pick a component which is not one of \*(lqTo:\*(rq,
107 \*(lqcc:\*(rq, \*(lqDate:\*(rq, \*(lqFrom:\*(rq, or \*(lqSubject:\*(rq.
108 An example is
109 .RB \*(lq "pick\0\-\|\-reply\-to\0pooh" \*(rq.
110 .PP
111 Pattern matching is performed on a per\-line basis. Within the header
112 of the message, each component is treated as one long line, but in the
113 body, each line is separate. Lower\-case letters in the search pattern
114 will match either lower or upper case in the message, while upper case
115 will match only upper case.
116 .PP
117 Note that since the
118 .B \-date
119 switch is a pattern matching operation (as
120 described above), to find messages sent on a certain date the pattern
121 string must match the text of the \*(lqDate:\*(rq field of the message.
122 .PP
123 Independent of any pattern matching operations requested, the switches
124 .B \-after
125 .I date
126 or
127 .B \-before
128 .I date
129 may also be used to introduce date/time
130 constraints on all of the messages. By default, the \*(lqDate:\*(rq
131 field is consulted, but if another date yielding field (such as
132 \*(lqBB\-Posted:\*(rq or \*(lqDelivery\-Date:\*(rq) should be used, the
133 .B \-datefield
134 .I field
135 switch may be used.
136 .PP
137 With
138 .B \-before
139 and
140 .BR \-after ,
141 .B pick
142 will actually parse the date
143 fields in each of the messages specified in `msgs' and compare them
144 to the date/time specified. If
145 .B \-after
146 is given, then only those
147 messages whose \*(lqDate:\*(rq field value is chronologically after the
148 date specified will be considered. The
149 .B \-before
150 switch specifies the
151 complimentary action.
152 .PP
153 Both the
154 .B \-after
155 and
156 .B \-before
157 switches take legal RFC 822\-style date
158 specifications as arguments.
159 .B pick
160 will default certain missing
161 fields so that the entire date need not be specified. These fields
162 are (in order of defaulting): timezone, time and timezone, date, date
163 and timezone. All defaults are taken from the current date, time,
164 and timezone.
165 .PP
166 In addition to RFC 822\-style dates,
167 .B pick
168 will also recognize any of
169 the days of the week (\*(lqsunday\*(rq, \*(lqmonday\*(rq, and so on),
170 and the special dates \*(lqtoday\*(rq, \*(lqyesterday\*(rq (24 hours
171 ago), and \*(lqtomorrow\*(rq (24 hours from now). All days of the
172 week are judged to refer to a day in the past (e.g., telling \fIpick\fR
173 \*(lqsaturday\*(rq on a \*(lqtuesday\*(rq means \*(lqlast\ saturday\*(rq
174 not \*(lqthis\ saturday\*(rq).
175 .PP
176 Finally, in addition to these special specifications,
177 .B pick
178 will
179 also honor a specification of the form \*(lq\-dd\*(rq, which means
180 \*(lqdd days ago\*(rq.
181 .PP
182 Use the
183 .BR \-reverse
184 switch to make
185 .B pick
186 find matching messages in reverse order, working from the highest message
187 number down to the lowest. This can be useful in for searching recent
188 messages in large folders, for example,
189 .PP
190 .RS 5
191 .nf
192 pick\0\-reverse\0\-from\0frated\0|\0xargs\0\-n1\0scan
193 .fi
194 .RE
195 .PP
196 .B pick
197 supports complex boolean operations on the searching primitives
198 with the
199 .BR \-and ,
200 .BR \-or ,
201 .BR \-not ,
202 and
203 .B \-lbrace
204 .B \&...
205 .B \-rbrace
206 switches.
207 For example,
208 .PP
209 .RS 5
210 .nf
211 pick\0\-after\0yesterday\0\-and
212 \-lbrace\0\-from\0freida\0\-or\0\-from\0fear\0\-rbrace
213 .fi
214 .RE
215 .PP
216 identifies messages recently sent by \*(lqfrieda\*(rq or \*(lqfear\*(rq.
217 .PP
218 The matching primitives take precedence over the
219 .B \-not
220 switch, which in turn takes precedence over
221 .B \-and
222 which in turn takes precedence
223 over
224 .BR \-or .
225 To override the default precedence, the
226 .B \-lbrace
227 and
228 .B \-rbrace
229 switches are provided, which act just like opening and closing
230 parentheses in logical expressions.
231 .PP
232 If no search criteria are given, all the messages specified on the
233 command line are selected (this defaults to \*(lqall\*(rq).
234 .PP
235 Once the search has been performed, if the
236 .B \-list
237 switch is given, the
238 message numbers of the selected messages are written to the standard
239 output separated by newlines. This is
240 .B extremely
241 useful for
242 quickly generating arguments for other
243 .B nmh
244 programs by using the
245 \*(lqbackquoting\*(rq syntax of the shell. For example, the command
246 .PP
247 .RS 5
248 scan\0`pick\0+todo\0\-after\0\*(lq31 Mar 83 0123 PST\*(rq`
249 .RE
250 .PP
251 says to
252 .B scan
253 those messages in the indicated folder which meet the
254 appropriate criterion. Note that since
255 .BR pick 's
256 context changes
257 are written out prior to
258 .BR scan 's
259 invocation, you need not give
260 the folder argument to
261 .B scan
262 as well.
263 .PP
264 The
265 .B \-sequence
266 .I name
267 switch may be given once for each sequence the user wishes to define.
268 For each sequence named, that sequence will be defined to mean exactly
269 those messages selected by
270 .BR pick .
271 For example,
272 .PP
273 .RS 5
274 pick\0\-from\0frated\0\-seq\0fred
275 .RE
276 .PP
277 defines a new message sequence for the current folder called
278 \*(lqfred\*(rq which contains exactly those messages that were selected.
279 .PP
280 The
281 .B \-nosequence
282 switch will disable all previously named sequences, allowing
283 those established by a profile component to be overridden.
284 .PP
285 By default,
286 .B pick
287 will zero a sequence before adding it. This
288 action can be disabled with the
289 .B \-nozero
290 switch, which means that the
291 messages selected by
292 .B pick
293 will be added to the sequence, if it
294 already exists, and any messages already a part of that sequence will
295 remain so.
296 .PP
297 The
298 .B \-public
299 and
300 .B \-nopublic
301 switches are used by
302 .B pick
303 in the
304 same way
305 .B mark
306 uses them.
307 .PP
308 The
309 .B \-debug
310 switch causes pick to output a representation of the search
311 pattern.
312 .SS "Output when no messages are matched"
313 If
314 .B pick
315 is used in a backquoted operation, such as
316 .PP
317 .RS 5
318 scan\0`pick\0\-from\0jones`
319 .RE
320 .PP
321 and
322 .B pick
323 selects no messages (e.g., no messages are from
324 \*(lqjones\*(rq), then the shell will still run the outer command (e.g.,
325 .BR scan ).
326 Since no messages were matched,
327 .B pick
328 produced
329 no output, and the argument given to the outer command as a result of
330 backquoting
331 .B pick
332 is empty. In the case of
333 .B nmh
334 programs,
335 the outer command now acts as if the default `msg' or `msgs' should be
336 used (e.g., \*(lqall\*(rq in the case of
337 .BR scan ).
338 To prevent this
339 unexpected behavior, if
340 .B \-list
341 was given, and if its standard output is not a tty, then
342 .B pick
343 outputs the illegal message number \*(lq0\*(rq
344 when it fails. This lets the outer command fail gracefully as well.
345 .SH FILES
346 .fc ^ ~
347 .nf
348 .ta \w'%nmhetcdir%/ExtraBigFileName 'u
349 ^$HOME/\&.mh\(ruprofile~^The user profile
350 .fi
351 .SH "PROFILE COMPONENTS"
352 .fc ^ ~
353 .nf
354 .ta 2.4i
355 .ta \w'ExtraBigProfileName 'u
356 ^Path:~^To determine the user's nmh directory
357 ^Current\-Folder:~^To find the default current folder
358 .fi
359 .SH "SEE ALSO"
360 .IR mark (1)
361 .SH DEFAULTS
362 .nf
363 .RB ` +folder "' defaults to the current folder"
364 .RB ` msgs "' defaults to all"
365 .RB ` "\-datefield date" '
366 .RB ` \-zero '
367 .RB ` \-list "' is the default if no `\-sequence', `\-nolist' otherwise"
368 .fi
369 .SH CONTEXT
370 If a folder is given, it will become the current folder.
371 .SH HISTORY
372 In previous versions of
373 .BR MH ,
374 the
375 .B pick
376 command would
377 .BR show ,
378 .BR scan ,
379 or
380 .B refile
381 the selected messages. This was rather
382 \*(lqinverted logic\*(rq from the UNIX point of view, so
383 .B pick
384 was changed to define sequences and output those sequences. Hence,
385 .B pick
386 can be used to generate the arguments for all other
387 .B MH
388 commands, instead of giving
389 .B pick
390 endless switches for invoking those commands
391 itself.
392 .PP
393 Also, previous versions of
394 .B pick
395 balked if you didn't specify
396 a search string or a date/time constraint. The current version does
397 not, and merely matches the messages you specify. This lets you type
398 something like:
399 .PP
400 .RS 5
401 show\0`pick\0last:20\0\-seq\0fear`
402 .RE
403 .PP
404 instead of typing
405 .PP
406 .RS 5
407 .nf
408 mark\0\-add\0\-nozero\0\-seq\0fear\0last:20
409 show\0fear
410 .fi
411 .RE
412 .PP
413 Finally, timezones used to be ignored when comparing dates: they aren't
414 any more.
415 .SH "HELPFUL HINTS"
416 Use
417 .RB \*(lq "pick sequence \-list" \*(rq
418 to enumerate the messages in a sequence
419 (such as for use by a shell script).
420 .SH BUGS
421 Any occurrence of
422 .B \-datefield
423 must occur prior to the
424 .B \-after
425 or
426 .B \-before
427 switch it applies to.
428 .PP
429 The pattern syntax \*(lq[l-r]\*(rq is not supported; each letter to be
430 matched must be included within the square brackets.