|
NAMEsortmail - sort email messages by date/timeSYNOPSISsortmail [ -chHmMyYrRvx ] mbox...DESCRIPTIONsortmail is a front end for decomposemail(1) and recomposemail(1). Each mailbox argument is disassembled into its component messages, then these messages are reassembled into new mailboxes based on command line selection criteria. Some additional functionality is provided, such as backup copies, recursion, etc.OPTIONSThe following options are supported:
OPERANDSThe following operands are supported:
USAGEsortmail can help to organize saved email for archival and retrieval purposes. Messages are sorted by date/time, then reassembled into new mailboxes. A notable feature is the ability to separate the messages into monthly or yearly mailboxes.The default behavior is to take each mbox (mailbox) argument, make a backup copy, make a working copy, decompose it into individual message files, and then recompose the messages ordered by date in increasing order. With the -m flag, the messages are reassembled into separate files per month, mbox.YYMM; for example, “mlist.9801”. With the -M flag, the messages are reassembled into separate files per month in subdirectories, YYMM/mbox; for example, “9801/mlist”. With the -y flag, the messages are reassembled into separate files per year, mbox.YYYY; for example, “mlist.1998”. With the -Y flag, the messages are reassembled into separate files per year in subdirectories, YYYY/mbox; for example, “1998/mlist”. If -Y is combined with -m, the messages are reassembled into separate files per month in yearly subdirectories, YYYY/mbox.MM; for example, “1998/mlist.01”. If -Y is combined with -M, the messages are reassembled into separate files per month in yearly and monthly subdirectories, YYYY/MM/mbox; for example, “1998/01/mlist”. In any of these cases, any such pre-existing mailboxes will be appended. If any such pre-existing mailboxes are compressed (.Z or .gz), they will first be uncompressed, and then recompressed after being modified. With the -c flag (along with -m, -M, -y, or -Y), the mbox file for the current month (if any) will be renamed as the original mbox. With the -R flag (along with -m, -M, -y, or -Y), when a month file is combined with one that already exists, the resulting file will be resorted. With the -H flag, all work is done in the current directory instead of in ./SM_WORK. This reduces the usefulness of some of the other options, and is a bit riskier. (Also known as “the gonzo option”.) By default, all work is done in a subdirectory ./SM_WORK, and all files to be modified are backed up in a subdirectory ./SM_BACKUP. These subdirectories are created if they don't already exist. These are not cleaned up after sorting, though none of the temporary message files or sort files should remain. Much of this can be accomplished using decomposemail(1) and recomposemail(1) directly, but many more manual steps are required. EXAMPLESSort the messages in the mailbox “mail/CERT”, not making a backup copy in ./SM_BACKUP, and rename the new sorted mailbox to the original mailbox. Without -r, the new mailbox would remain in “./SM_WORK”:sortmail -xr mail/CERT Sort the messages in the mailbox “FreeBSD”, separating messages by month into mailboxes like “FreeBSD.9801”, “FreeBSD.9802”, etc. The original mailbox will be overwitten with any messages for the current month: sortmail -mc FreeBSD Sort the messages in the mailboxes “maya” and “jim”, separating messages by month into mailboxes in subdirectories like “9801/maya”, “9801/jim”, “9802/maya”, “9802/jim”, etc. Any such pre-existing mailboxes that are appended will also be resorted: sortmail -MR maya jim Sort the messages in the mailbox “yada”, separating messages by month into mailboxes in subdirectories like “1998/01/yada”, “1998/02/yada”, etc. Any such pre-existing mailboxes that are appended will also be resorted, and the original mailbox will be overwitten with any messages for the current month: sortmail -YMcR yada FILES
DIAGNOSTICSReturns 0 if no problems encountered.Returns non-zero for any errors encountered. BUGSsortmail is a shell script that uses the filesystem for sorting. It is slow.Due to copies made during the sorting process, you should have enough additional space in your current partition and/or quota to hold three full copies of each original mbox. sortmail is quite verbose, even without the -v option. A quiet option should be added. Data at the beginning of a mailbox that does not appear to be part of an email message will be silently discarded. sortmail creates working directories and backup copies of mailboxes, and does not clean up after itself (except as noted above). sortmail relies on the scripts decomposemail(1) and recomposemail(1). This is either a bug or a feature. SEE ALSOcompress(1), decomposemail(1), gzip(1), recomposemail(1), sh(1);mailsort (Perl script, available from CPAN sites); “Toolman: Sorting and Archiving Email”, ;login: magazine (USENIX Association), August 1998; <http://www.cs.duke.edu/~des/sortmail.html>. AUTHORsortmail was written by Daniel E. Singer (a.k.a. Toolman) at the Department of Computer Science, Duke University.
Visit the GSP FreeBSD Man Page Interface. |