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