scan(1mh)
Name
scan − produce a one-line-per-message scan listing
Syntax
scan [+folder] [msgs] [−clear] [−noclear] [−form formatfile] [−format string] [−header] [−noheader] [−width columns] [−help]
Description
The scan command produces a one-line-per-message listing of the messages in the current folder. You can scan a folder other than the current folder by using the +foldername argument.
You can use the msgs argument to produce a scan listing of a number of messages or a range of messages in the specified folder. The following example would produce a listing of messages 10 through 20 in the folder +inbox.
$ scan +inbox 10−20
You can also use scan in conjunction with a message sequence defined by pick. See pick() for details.
Each scan line contains the message number (name), the date, the From: field, the Subject: field, and, if room allows, some of the body of the message. For example:
15+7/ 5DcrockerVolunteers <<Last week I asked
16 -7/ 5dcrockermessage id format <<I recommend
187/ 6Obrien Re: Exit status from mkdir
197/ 7Obrien “scan” listing format in MH
The + on message 15 indicates that it is the current message. The − on message 16 indicates that it has been replied to, as indicated by a Replied: component produced by an −annotate switch to the repl command. If there is sufficient room left on the scan line after the subject, the line will be filled with text from the body, preceded by <<, and terminated by >> if the body is sufficiently short.
Scan actually reads each of the specified messages and parses them to extract the desired fields. During parsing, appropriate error messages will be produced if there are format errors in any of the messages.
Options
The −header switch produces a header line prior to the scan listing. The header line displays the name of the folder and the date and time.
If the −clear switch is used and scan’s output is directed to a terminal, then scan will consult the $TERM and $TERMCAP envariables to determine your terminal type in order to find out how to clear the screen prior to exiting. If the −clear switch is used and scan’s output is not directed to a terminal, then scan will send a formfeed prior to exiting.
In the following example, the scan command produces a scan listing of the current folder, followed by a formfeed, followed by a formatted listing of all messages in the folder, one per page. Omitting −show pr −f will cause the messages to be concatenated, separated by a one-line header and two blank lines.
(scan −clear −header; show all −show pr −f) | lpr
If scan encounters a message without a Date: field, the date is filled in with the last write date of the message, and post-fixed with a *. This is particularly useful for scanning a draft folder, as message drafts usually are not allowed to have dates in them.
To override the output format used by scan, the −format string or −format file switches are used. This permits individual fields of the scan listing to be extracted with ease. The string is simply a format string and the file is simply a format file. See mh-format() for more details.
Because MH has been configured with the BERK option, scan has two other switches: −reverse and −noreverse. These make scan list the messages in reverse order. In addition, scan will update the MH context prior to starting the listing, so interrupting a long scan listing preserves the new context. The default configuration file that is supplied with MH has the BERK option enabled.
The defaults for this command are:
+folder defaults to the folder current
msgs defaults to all
−format defaulted as described above
−noheader
−width defaulted to the width of the terminal
The argument to the −format switch must be interpreted as a single token by the shell that invokes scan. Therefore, you should place the argument to this switch inside double−quotes (" ").
Files
| $HOME/.mh_profile | The user profile |
Profile Components
| Path: | To determine your MH directory |
| Alternate-Mailboxes: | To determine your mailboxes |
| Current-Folder: | To find the default current folder |