# phpman > man > scan(1mh)

[SCAN(1mh)](https://www.chedong.com/phpMan.php/man/SCAN/1mh/markdown)                                                                                  [SCAN(1mh)](https://www.chedong.com/phpMan.php/man/SCAN/1mh/markdown)



## NAME
       scan - produce a summary listing of nmh messages

## SYNOPSIS
       **scan** [**-help**] [**-version**] [_+folder_] [_msgs_] [**-clear** | **-noclear**] [**-form** _formatfile_] [**-format**
            _string_] [**-header** | **-noheader**] [**-width** _columns_] [**-reverse** | **-noreverse**] [**-file** _filename_]

## DESCRIPTION
       **scan** produces a one-line-per-message listing of the specified folder or messages.  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+  10/05 crocker    nned  <<Last week I asked some of
            16-  10/05 crocker    message id format  <<I recommend
            18   10/06 brien      Re: Exit status from mkdir
            19   10/07*brien      “scan” listing format in nmh

       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 the **-annotate** switch to the **repl** command).

       The `*' on message 19 indicates that no “Date:” header was present.  The time of last modifi‐
       cation of the message is given instead.

       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 de‐
       sired  fields.  During parsing, appropriate error messages will be produced if there are for‐
       mat errors in any of the messages.

       By default, **scan** will decode RFC 2047 (MIME) encoding in these scan listings.  **scan** will only
       decode  these  fields if your terminal can natively display the character set used in the en‐
       coding.  You should set the appropriate [_locale_(1)](https://www.chedong.com/phpMan.php/man/locale/1/markdown) environment variables to your native  char‐
       acter set, if it is not US-ASCII.  See [_locale_(1)](https://www.chedong.com/phpMan.php/man/locale/1/markdown) for more details on the appropriate environ‐
       ment variables.

       The switch **-reverse**, makes **scan** list the messages in reverse order.

       The **-file** _filename_ switch allows the user to obtain a **scan** listing of a  mail  drop  file  as
       produced  by **packf**.  This listing includes every message in the file (you can't scan individ‐
       ual messages).  The switch **-reverse** is ignored with this option.

       The switch **-width** _columns_ may be used to specify the width of the scan line.  The default  is
       to use the width of the terminal.

       The  **-header** switch produces a header line prior to the **scan** listing.  Currently, the name of
       the folder and the current date and time are output (see the **HISTORY** section for more  infor‐
       mation).

       If the **-clear** switch is used and **scan**'s output is directed to a terminal, then **scan** will con‐
       sult the environment variables **$TERM** and **$TERMCAP** 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 (e.g., a pipe or a file), then **scan** will send a formfeed
       prior to exiting.

       For example, the command:

            (scan -clear -header; show all -show pr -f) | lpr

       produces  a scan listing of the current folder, followed by a formfeed, followed by a format‐
       ted 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.

       To  override  the  output  format used by **scan**, the **-format** _string_ or **-form** _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_(5)](https://www.chedong.com/phpMan.php/man/mh-format/5/markdown) for
       the details.

       In addition to the standard [_mh-format_(5)](https://www.chedong.com/phpMan.php/man/mh-format/5/markdown) escapes, **scan** also recognizes  the  following  addi‐
       tional _component_ escapes:

            _Escape_    _Returns_  _Description_
            body      string   the (compressed) first part of the body
            dtimenow  date     the current date
            folder    string   the name of the current folder

       {**body**}  returns  a  string without MIME decoding, i.e. the MIME boundary seperator may be the
       first text shown.

       If no date header is present in the message, the _function_ escapes  which  operate  on  {**date**}
       will  return  values for the date of last modification of the message file itself.  This fea‐
       ture is handy for scanning a draft folder, as message drafts usually aren't allowed  to  have
       dates in them.

       The **/etc/nmh** directory contains several format files as examples of customized **scan** output.

       **scan**  will  update the **nmh** context prior to starting the listing, so interrupting a long **scan**
       listing preserves the new context.  **nmh** purists hate this idea.

## FILES
       $HOME/.mh_profile          The user profile

## PROFILE COMPONENTS
       Path:                To determine the user's nmh directory
       Alternate-Mailboxes: To determine the user's mailboxes
       Current-Folder:      To find the default current folder

## SEE ALSO
       [_pick_(1)](https://www.chedong.com/phpMan.php/man/pick/1/markdown), [_show_(1)](https://www.chedong.com/phpMan.php/man/show/1/markdown), [_mh-format_(5)](https://www.chedong.com/phpMan.php/man/mh-format/5/markdown)

## DEFAULTS
       `**+folder**' defaults to the current folder
       `**msgs**' defaults to all
       `**-format**' defaulted as described above
       `**-noheader**'
       `**-width**' defaulted to the width of the terminal

## CONTEXT
       If a folder is given, it will become the current folder.

## HISTORY
       Prior to using the format string mechanism, **-header** used to generate a  heading  saying  what
       each column in the listing was.  Format strings prevent this from happening.

## BUGS
       The value of each _component_ escape is set by **scan** to the contents of the first message header
       **scan** encounters with the corresponding component name; any following headers  with  the  same
       component name are ignored.



nmh-1.7.1                                    2014-01-20                                    [SCAN(1mh)](https://www.chedong.com/phpMan.php/man/SCAN/1mh/markdown)
