aa08f820c4dee8f16dfcfdab4e0c43d79c9145c4
[mmh] / man / sortm.man
1 .TH SORTM %manext1% "October 11, 2012" "%nmhversion%"
2 .\"
3 .\" %nmhwarning%
4 .\"
5 .SH NAME
6 sortm \- sort messages
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B sortm
11 .RI [ +folder ]
12 .RI [ msgs ]
13 .RB [ \-all " | " \-noall ]
14 .RB [ \-datefield
15 .IR field ]
16 .RB [ \-textfield
17 .IR field ]
18 .RB [ \-notextfield ]
19 .RB [ \-limit
20 .IR days ]
21 .RB [ \-nolimit ]
22 .RB [ \-check " | " \-nocheck ]
23 .RB [ \-verbose " | " \-noverbose ]
24 .RB [ \-version ]
25 .RB [ \-help ]
26 .ad
27 .SH DESCRIPTION
28 .B Sortm
29 sorts the specified messages in the named folder according
30 to the chronological order of the \*(lqDate:\*(rq field of each message.
31 .PP
32 If no messages are specified, the default is all messages in the folder.
33 However, if no messages are specified and the
34 .B \-noall
35 switch is enabled, then
36 .B sortm
37 reports that as an error and exits with non-zero status.
38 .B \-noall
39 is most useful in the user's profile, to avoid inadvertant sorting of
40 an entire folder.  The
41 .B \-all
42 switch can then be used on the command line to disable it.  Of course,
43 a message specification of
44 .I all
45 can be used in any case.
46 .PP
47 The
48 .B \-verbose
49 switch directs
50 .B sortm
51 to tell the user the general
52 actions that it is taking to place the folder in sorted order.
53 .PP
54 The
55 .B \-datefield
56 .I field
57 switch tells
58 .B sortm
59 the name of the field to
60 use when making the date comparison.  If the user has a special field in
61 each message, such as \*(lqBB\-Posted:\*(rq or \*(lqDelivery\-Date:\*(rq,
62 then the
63 .B \-datefield
64 switch can be used to direct
65 .B sortm
66 which field to examine.
67 .PP
68 The
69 .B \-textfield
70 .I field
71 switch causes
72 .B sortm
73 to sort messages by the specified text field.  All characters except
74 letters and numbers are stripped and the resulting strings are sorted
75 datefield\-major, textfield\-minor, using a case insensitive
76 comparison.  If this field is \*(lqsubject\*(rq, any leading "re:" is
77 stripped off.
78 .PP
79 With
80 .B \-textfield
81 .IR field ,
82 if
83 .B \-limit
84 .I days
85 is specified, messages
86 with the same textfields that are dated within `days' of each other
87 appear together.  Specifying
88 .B \-nolimit
89 makes the limit infinity.
90 With
91 .B \-limit
92 .IR 0 ,
93 the sort is instead simply textfield\-major.
94 .PP
95 For example, to order a folder by date-major, grouping messages with
96 the same subject on the same date together, use:
97 .PP
98 .RS 5
99 sortm -textfield subject +folder
100 .RE
101 .PP
102 .B sortm
103 always issues a warning for each message that is missing a
104 \*(lqDate:\*(rq field, has a \*(lqDate:\*(rq field that cannot be
105 parsed, or has a format error in any header field.  With the
106 .B \-check
107 switch,
108 .B sortm
109 inhibits all modifications to the folder if there any such messages,
110 and exits with non-zero status.  With the default of
111 .BR \-nocheck ,
112 .B sortm
113 sorts messages with a missing or invalid
114 \*(lqDate:\*(rq field using their file modification times.
115 .SH FILES
116 .fc ^ ~
117 .nf
118 .ta \w'%etcdir%/ExtraBigFileName  'u
119 ^$HOME/\&.mh\(ruprofile~^The user profile
120 .fi
121 .SH "PROFILE COMPONENTS"
122 .fc ^ ~
123 .nf
124 .ta 2.4i
125 .ta \w'ExtraBigProfileName  'u
126 ^Path:~^To determine the user's nmh directory
127 ^Current\-Folder:~^To find the default current folder
128 .fi
129 .SH "SEE ALSO"
130 .IR folder (1)
131 .SH DEFAULTS
132 .nf
133 .RB ` +folder "' defaults to the current folder"
134 .RB ` msgs"' defaults to all without -noall, no default with -noall"
135 .RB ` \-all '
136 .RB ` \-datefield "' defaults to date"
137 .RB ` \-notextfield '
138 .RB ` \-noverbose '
139 .RB ` \-nolimit '
140 .RB ` \-nocheck '
141 .fi
142 .SH CONTEXT
143 If a folder is given, it will become the current folder.  If the current
144 message is moved,
145 .B sortm
146 will preserve its status as current.
147 .SH HISTORY
148 Timezones used to be ignored when comparing dates: they aren't any more.
149 .PP
150 Messages which were in the folder, but not specified by `msgs', used to
151 be moved to the end of the folder; now such messages are left untouched.
152 .PP
153 .B Sortm
154 sometimes did not preserve the message numbering in a folder
155 (e.g., messages 1, 3, and 5, might have been renumbered to 1, 2, 3 after
156 sorting).  This was a bug, and has been fixed.  To compress the message
157 numbering in a folder, use
158 .RB \*(lq "folder\ \-pack" \*(rq
159 as always.
160 .SH BUGS
161 When
162 .B sortm
163 complains about a message which it can't temporally
164 order, it complains about the message number
165 .B prior
166 to sorting.
167 It should indicate what the message number will be
168 .B after
169 sorting.