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