MSORT(1) | User Commands | MSORT(1) |
msort - sort records in complex ways
msort <options> [<input file>]
msort is a program for sorting text files in sophisticated ways. It was developed initially for alphabetizing dictionaries of languages in which the ordering may be quite different from English but has many other uses.
msort allows you to sort blocks of text delimited in a number of ways rather than just lines and to specify particular fields of a record as sort keys using either their position, counted from either end, or by matching regular expressions to their tags.
msort is capable of sorting on multiple keys, so that when two records tie on one key, the tie may be broken on another. Any or all keys may be optional. How absent optional keys are ordered with respect to present keys may be set separately for each key.
msort allows you to specify arbitrary sort orders and to define virtually unlimited numbers of multigraphs of effectively unlimited length. The sort order and multigraphs are defined separately for each key. If your system has locale support, you can also use locale collation rules instead of specify your own sort order.
msort provides twelve types of key comparison: lexicographic, numeric, numeric string, hybrid, by string length, by angle, by date, by domain name, by time, by ISO8601 date/time stamp, by month name, and random.
What month names are used is a bit complicated. If the -s flag is used on the same key and its argument is the name of a file, the month names are read from the file, which should be in the same format as a sort order definition file. If the -s flag is used and its argument is a locale name, the month names recognized will be the month names and abbreviations associated with the specified locale. If the -s flag is not used the month names recognized will be the month names and abbreviations associated with the current locale. If your system does not have locale support and you do not use the -s flag to read the month names from a file, the month names recognized will be the English month names and abbreviations.
msort can reverse the characters in a key, allowing it to be used to generate reverse dictionaries.
A choice of sorting algorithms is provided.
msort fully supports Unicode. The text to be sorted, and all specifications, should be in UTF-8 Unicode. (If you have plain ASCII text, this is not a problem as ASCII is a subset of Unicode.) Full Unicode case-folding is available, in Turkic and non-Turkic variants. Unicode normalization is performed before sorting.
For usage information, execute msort with no arguments.
Full information about msort is currently to be found in
the reference manual, which is distributed as a PDF (Portable Document
Format) file. If a copy is not available locally, you can download it from
msort's home page:
http://billposer.org/Software/msort.html
Note: long options may not be available on your system.
Bill Poser (billposer@alum.mit.edu)
GNU General Public License (http://www.gnu.org/licenses/gpl.html), version 3.
January 2010 | msort |