1PICK(1)                      [nmh-1.2-20070115cvs]                     PICK(1)
2
3
4

NAME

6       pick - search for messages by content
7

SYNOPSIS

9       pick [+folder] [msgs] [-and ...]  [-or ...]  [-not ...]  [-lbrace ...
10            -rbrace] [--component pattern] [-cc pattern] [-date pattern]
11            [-from pattern] [-search pattern] [-subject pattern] [-to pattern]
12            [-after date] [-before date] [-datefield field] [-sequence name
13            ...]  [-public | -nopublic] [-zero | -nozero] [-list | -nolist]
14            [-version] [-help]
15
16       typical usage:
17
18            scan `pick -from jones`
19            pick -to holloway -sequence select
20            show `pick -before friday`
21

DESCRIPTION

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  complimentary
70       action.
71
72       Both the -after and -before switches take legal 822-style date specifi‐
73       cations as arguments.  Pick will default certain missing fields so that
74       the  entire  date need not be specified.  These fields are (in order of
75       defaulting): timezone, time and timezone, date, date and timezone.  All
76       defaults are taken from the current date, time, and timezone.
77
78       In  addition  to  822-style  dates, pick will also recognize any of the
79       days of the week (“sunday”, “monday”, and so on), and the special dates
80       “today”,  “yesterday”  (24  hours  ago),  and “tomorrow” (24 hours from
81       now).  All days of the week are judged to refer to a day  in  the  past
82       (e.g., telling pick “saturday” on a “tuesday” means “last saturday” not
83       “this saturday”).
84
85       Finally, in addition to these special specifications,  pick  will  also
86       honor a specification of the form “-dd”, which means “dd days ago”.
87
88       Pick  supports  complex  boolean operations on the searching primitives
89       with the -and, -or, -not, and -lbrace ...  -rbrace switches.  For exam‐
90       ple,
91
92            pick -after yesterday -and
93                 -lbrace -from freida -or -from fear -rbrace
94
95       identifies messages recently sent by “frieda” or “fear”.
96
97       The  matching primitives take precedence over the -not switch, which in
98       turn takes precedence over -and which in  turn  takes  precedence  over
99       -or.   To  override  the  default  precedence,  the -lbrace and -rbrace
100       switches are provided, which act just like opening and  closing  paren‐
101       theses in logical expressions.
102
103       If no search criteria are given, all the messages specified on the com‐
104       mand line are selected (this defaults to “all”).
105
106       Once the search has been performed, if the -list switch is  given,  the
107       message  numbers  of  the selected messages are written to the standard
108       output separated by newlines.  This is  extremely  useful  for  quickly
109       generating  arguments for other nmh programs by using the “backquoting”
110       syntax of the shell.  For example, the command
111
112            scan `pick +todo -after “31 Mar 83 0123 PST”`
113
114       says to scan those messages in the  indicated  folder  which  meet  the
115       appropriate  criterion.   Note  that  since  pick's context changes are
116       written out prior to scan's invocation, you need not  give  the  folder
117       argument to scan as well.
118
119       The  -sequence name switch may be given once for each sequence the user
120       wishes to define.  For each  sequence  named,  that  sequence  will  be
121       defined to mean exactly those messages selected by pick.  For example,
122
123            pick -from frated -seq fred
124
125       defines  a  new  message  sequence for the current folder called “fred”
126       which contains exactly those messages that were selected.
127
128       By default, pick will zero the sequence before adding it.  This  action
129       can  be disabled with the -nozero switch, which means that the messages
130       selected by pick will be added to the sequence, if it  already  exists,
131       and any messages already a part of that sequence will remain so.
132
133       The  -public  and  -nopublic  switches are used by pick in the same way
134       mark uses them.
135
136

FILES

138       $HOME/.mh_profile          The user profile
139
140

PROFILE COMPONENTS

142       Path:                To determine the user's nmh directory
143       Current-Folder:      To find the default current folder
144
145

SEE ALSO

147       mark(1)
148
149

DEFAULTS

151       `+folder' defaults to the current folder
152       `msgs' defaults to all
153       `-datefield date'
154       `-zero'
155       `-list' is the default if no `-sequence', `-nolist' otherwise
156
157

CONTEXT

159       If a folder is given, it will become the current folder.
160
161

HISTORY

163       In previous versions of MH, the  pick  command  would  show,  scan,  or
164       refile  the  selected  messages.  This was rather “inverted logic” from
165       the UNIX point of view, so pick was changed  to  define  sequences  and
166       output  those sequences.  Hence, pick can be used to generate the argu‐
167       ments for all  other  MH  commands,  instead  of  giving  pick  endless
168       switches for invoking those commands itself.
169
170       Also,  previous  versions of pick balked if you didn't specify a search
171       string or a date/time constraint.  The current version  does  not,  and
172       merely  matches the messages you specify.  This lets you type something
173       like:
174
175            show `pick last:20 -seq fear`
176
177       instead of typing
178
179            mark -add -nozero -seq fear last:20
180            show fear
181
182       Finally, timezones used to be ignored when comparing dates: they aren't
183       any more.
184
185

HELPFUL HINTS

187       Use “pick sequence -list” to enumerate the messages in a sequence (such
188       as for use by a shell script).
189
190

BUGS

192       The argument to the -after and -before switches must be interpreted  as
193       a  single  token  by  the shell that invokes pick.  Therefore, one must
194       usually place the argument to this switch inside  double-quotes.   Fur‐
195       thermore,  any  occurrence of -datefield must occur prior to the -after
196       or -before switch it applies to.
197
198       If pick is used in a back-quoted operation, such as
199
200            scan `pick -from jones`
201
202       and pick selects no messages (e.g., no messages are from “jones”), then
203       the shell will still run the outer command (e.g., scan).  Since no mes‐
204       sages were matched, pick produced no output, and the argument given  to
205       the  outer  command  as  a result of backquoting pick is empty.  In the
206       case of nmh programs, the outer command now  acts  as  if  the  default
207       `msg'  or  `msgs' should be used (e.g., “all” in the case of scan).  To
208       prevent this unexpected behavior, if -list was given, and if its  stan‐
209       dard  output is not a tty, then pick outputs the illegal message number
210       “0” when it fails.  This lets the  outer  command  fail  gracefully  as
211       well.
212
213       The  pattern syntax “[l-r]” is not supported; each letter to be matched
214       must be included within the square brackets.
215
216
217
218MH.6.8                            1 Jul 2003                           PICK(1)
Impressum