{
    "mode": "man",
    "parameter": "sortm",
    "section": "1mh",
    "url": "https://www.chedong.com/phpMan.php/man/sortm/1mh/json",
    "generated": "2026-06-15T14:41:38Z",
    "synopsis": "sortm [-help] [-version] [+folder] [msgs] [-all | -noall] [-datefield field] [-textfield\nfield] [-notextfield] [-limit days] [-nolimit] [-check | -nocheck] [-verbose | -nover‐‐\nbose]",
    "sections": {
        "NAME": {
            "content": "sortm - sort nmh messages\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sortm [-help] [-version] [+folder] [msgs] [-all | -noall] [-datefield field] [-textfield\nfield] [-notextfield] [-limit days] [-nolimit] [-check | -nocheck] [-verbose | -nover‐‐\nbose]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "sortm  sorts  the specified messages in the named folder according to the chronological order\nof the “Date:” field of each message.\n\nIf no messages are specified, the default is all messages in the folder.  However, if no mes‐\nsages are specified and the -noall switch is enabled, then sortm reports that as an error and\nexits with non-zero status.  -noall is most useful in the user's profile, to  avoid  inadver‐\ntent  sorting  of  an entire folder.  The -all switch can then be used on the command line to\ndisable it.  Of course, a message specification of all can be used in any case.\n\nThe -verbose switch directs sortm to tell the user the general actions that it is  taking  to\nplace the folder in sorted order.\n\nThe  -datefield  field  switch  tells sortm the name of the field to use when making the date\ncomparison.  If the user has a special field in each message, such as “BB-Posted:” or “Deliv‐\nery-Date:”, then the -datefield switch can be used to direct sortm which field to examine.\n\nThe  -textfield  field switch causes sortm to sort messages by the specified text field.  All\ncharacters except letters and numbers are stripped and the resulting strings are sorted date‐\nfield-major,  textfield-minor,  using  a case insensitive comparison.  If this field is “sub‐\nject”, any leading \"re:\" is stripped off.\n\nWith -textfield field, if -limit days is specified, messages with the  same  textfields  that\nare  dated  within `days' of each other appear together.  Specifying -nolimit makes the limit\ninfinity.  With -limit 0, the sort is instead simply textfield-major.\n\nFor example, to order a folder by date-major, grouping messages with the same subject on  the\nsame date together, use:\n\nsortm -textfield subject +folder\n\nsortm always issues a warning for each message that is missing a “Date:” field, has a “Date:”\nfield that cannot be parsed, or has a format error in any  header  field.   With  the  -check\nswitch,  sortm  inhibits  all modifications to the folder if there are any such messages, and\nexits with non-zero status.  With the default of -nocheck, sortm sorts messages with a  miss‐\ning or invalid “Date:” field using their file modification times.\n\nWhen ordering messages based on their dates, if they have the same dates, their original mes‐\nsage order is preserved.\n",
            "subsections": []
        },
        "FILES": {
            "content": "$HOME/.mhprofile          The user profile\n",
            "subsections": []
        },
        "PROFILE COMPONENTS": {
            "content": "Path:                To determine the user's nmh directory\nCurrent-Folder:      To find the default current folder\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "folder(1)\n",
            "subsections": []
        },
        "DEFAULTS": {
            "content": "`+folder' defaults to the current folder\n`msgs\"'defaultstoallwithout-noall,nodefaultwith-noall\"\n`-all'\n`-datefield' defaults to date\n`-notextfield'\n`-noverbose'\n`-nolimit'\n`-nocheck'\n",
            "subsections": []
        },
        "CONTEXT": {
            "content": "If a folder is given, it will become the current folder.  If the current  message  is  moved,\nsortm will preserve its status as current.\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "Timezones used to be ignored when comparing dates: they aren't any more.\n\nMessages  which  were in the folder, but not specified by `msgs', used to be moved to the end\nof the folder; now such messages are left untouched.\n\nsortm sometimes did not preserve the message numbering in a folder (e.g., messages 1, 3,  and\n5, might have been renumbered to 1, 2, 3 after sorting).  This was a bug, and has been fixed.\nTo compress the message numbering in a folder, use “folder -pack” as always.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "When sortm complains about a message which it can't temporally order, it complains about  the\nmessage  number  prior  to sorting.  It should indicate what the message number will be after\nsorting.\n\n\n\nnmh-1.7.1                                    2014-03-23                                   SORTM(1mh)",
            "subsections": []
        }
    },
    "summary": "sortm - sort nmh messages",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "folder",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/folder/1/json"
        }
    ]
}