pick(1mh)
Name
pick − select messages by content
Syntax
pick [+folder] [msgs] [−and ...] [−or ...] [−not ...] [−lbrace ... −rbrace] [−cc pattern] [−date pattern] [−from pattern] [−search pattern] [−subject pattern] [−to pattern] [−−othercomponent pattern] [−after date] [−before date] [−datefield field] [−sequence name ...] [−public] [−nopublic] [−zero] [−nozero] [−list] [−nolist] [−help]
Description
Pick lets you search messages in a folder on a diverse range of search criteria.
You can search the mail headers or the text of some or all of the messages within a folder for the specified criteria. You can use pattern matching or date constraint operations. You can define the messages found as a sequence or you can use the results directly. The following example shows pick identifying all the mail in the current folder that was sent by Christine.
% pick −from christine
1
3
8
The search of the mail header fields that has just been performed is case insensitive. Therefore in the previous example, pick would find messages that were from Christine as well as messages that were from christine. However the full −search option is not case insensitive. The way in which the −search option works is described later in this reference page.
Options
You can search on the contents of any known mail header field by specifying the header field as a −option. The mail header fields that pick knows about are To:, cc:, Date:, From:, or Subject:.
If you want to search on some other mail header field, you can do this by using the −− component pattern option. If you use this option, you must precede the mail header field with two minus signs. The following example shows pick being used to search on the reply−to: field.
% pick −−reply−to Scott
17
If you want to search the entire message, and not just the message header, you can do this using the −search option. The −search option is a modified grep(.). As such it gives full regular expression capabilities (see ed())) within pattern matching.
Pattern matching is performed on a per-line basis. Within the header of the message, each component is treated as one long line, but in the body, each line is separate. 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.
The following example shows a pick command that will search all messages in the current folder for the word strawberries.
% pick −search "strawberries"
2
4
You can specify a folder other than the current folder using the +foldername option. Also, if you do not want to search all messages within the specified folder, you can specify more than one message or a range of messages using the message numbers. In the following example pick searches messages 10−20 in the +sent folder for messages that were sent to Kafka.
% pick +sent 10−20 −to Kafka
pick: no messages match specification
You can define a sequence name in which pick can store the details of the messages found. You can manipulate these sequences with any of the MH commands that will take the msgs argument.
A sequence name should always begin with a letter and should not contain any non-alphanumeric characters such as punctuation marks. The following example shows the creation of a sequence called Jack.
% pick −from Jack −sequence Jack
3 hits
Whenever pick processes a −sequence name, it calls the −nolist option. This suppresses the list of messages meeting the search criteria that pick normally generates. Instead pick indicates how many records met the search criteria.
pick normally zeros the sequence before adding to it. This means that any messages that are already in the defined sequence will be lost. If you want to save the messages that are already in the defined sequence, you can do so by specifying the −nozero option. In this case the new messages will be added to the existing messages and numbered accordingly.
If the messages that make up a message sequence are read only, the message sequence that you create will not be accessible to other MH users. If you want to change this you can do so with the −public and −nopublic switches. You can use the −nopublic switch to ensure that the sequence that you create is only accessible to yourself.
In addition to this, you can also combine the output of pick directly with any MH command. In order to do this you need to encase the pick command, and its associated options and arguments, inside single back quotes (‘ ‘). This technique is known as back quoting and is familiar to most ULTRIX users. You should consult your ULTRIX shell Reference Pages for more details. The following example would give you a listing of all the mail sent to you from Jones. See scan() for details of the listing that would be produced.
% scan ‘pick −from jones‘
If pick finds that there is no mail from Jones, it will output the illegal character 0. This will cause the MH command, that was going to process the output from the pick operation, to fail gracefully.
Independent of any pattern-matching operations requested, the switches −after date or −before date may also be used to introduce date/time constraints on all of the messages. By default, the Date: field is consulted. However you can specify an alternative date field, such as Delivery−Date:, by using the −datefield field option. You must define the −datefield before you use the −after or −before switch it applies to. You must place the arguments to the −after or −before switches inside double-quotes (" ").
The following example shows pick searching for all messages sent to Holloway since 10th June.
% pick -to holloway -after "10 Jun 88"
19
Pick will actually parse the date fields in each of the specified messages and compare them to the date/time specified by the −after and −before switches. If −after is given, then only those messages whose Date: field value is chronologically after the date specified will be examined. The −before switch specifies the complementary action.
Both the −after and −before switches take legal RFC 822−style date specifications as arguments. pick will assume certain missing fields so that the entire date need not be specified. 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.
In addition to 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, and tomorrow. All days of the week refer to a day in the past. Therefore pick interprets Saturday as last Saturday and not this Saturday. Finally, in addition to these special specifications, you can also direct pick to start its search a number of days ago. The following example searches for messages sent about strawberries in the last ten days.
% pick -subject: strawberries -10
1
6
The pick command also 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.
You can override the default precedence with the −lbrace and −rbrace switches. These act just like opening and closing parentheses in logical expressions.
Restrictions
The sequence name, punctuation and message list must not exceed 1024 characters. In practice, this gives a reasonable limit of approximately 200 non-consecutive messages in a sequence.
Files
| $HOME/.mh_profile | The user profile |
Profile Components
| Path: | To determine your MH directory |
| Current−Folder: | To find the default current folder |