How To Install msort on Ubuntu 22.04

In this tutorial we learn how to install msort on Ubuntu 22.04. msort is utility for sorting records in complex ways

Introduction

In this tutorial we learn how to install msort on Ubuntu 22.04.

What is msort

msort is:

msort is a program for sorting files in sophisticated ways. It was originally developed for alphabetizing dictionaries of “exotic” languages, for which it has been extensively used, but is useful for many other purposes. msort differs from typical sort utilities in providing greater flexibility in parsing the input into records and identifying key fields and greater control over the sort order. Its main distinctive features are:

o Msort can be used as a command-line program or via a graphical user interface that is helpful not only to those who find a complicated command line difficult to deal with but also to those unfamiliar with the finer points of sorting. o Records need not be single lines of text but may be delimited in a number of ways. o Key fields may be selected by position in the record (counting from the beginning or the end), by character ranges (e.g. the key consists of the fourth through eighth characters), or by matching a regular expression to a tag. o For each key an arbitrary sort order may be specified. Msort also understands locales. o For each key an effectively unlimited number of multigraphs (sequences of characters to be treated as a single unit for purposes of sorting, “collating elements” in Unicode parlance) of effectively unlimited length may be defined. o In addition to the usual lexicographic and numerical comparisons, msort supports hybrid lexicographic-numeric comparison (for things like filenames and section headings, so that, e.g., 2a will precede 10b), random comparison, and ordering by angle, date, time, month name, domain name, email address, ISO8601 date-time, and string length. o Numbers may be in just about any known number system, e.g. Chinese or Devanagari. o For each key a distinct set of characters may be excluded from consideration when sorting in any combination of initial, final, and medial position in the key field. o For each key a distinct set of regular expression substitutions may be defined. These provide the means to make names like McCarthy sort before MacCawley, as if McCarthy were spelled MacCarthy as well as to handle the rare cases in which a single character is treated for purposes of sorting as a sequence, such as German “eszet” sign, which is traditionally sorted as if it were ss. o Lexicographic keys may be reversed, allowing the construction of reverse dictionaries. o Any or all keys may be optional. For optional keys, the user may specify how records missing the key field should compare to records in which the key field is present. o A choice of sorting algorithms with different properties is provided.

msort understands UTF-8 Unicode. Unicode may be used anywhere that text is entered: in the text to be sorted, in sort order and exclusion definitions, as a field or record separator, or as a field tag. Full Unicode case-folding is available.

There are three methods to install msort on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install msort Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install msort using apt-get by running the following command:

sudo apt-get -y install msort

Install msort Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install msort using apt by running the following command:

sudo apt -y install msort

Install msort Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install msort using aptitude by running the following command:

sudo aptitude -y install msort

How To Uninstall msort on Ubuntu 22.04

To uninstall only the msort package we can use the following command:

sudo apt-get remove msort

Uninstall msort And Its Dependencies

To uninstall msort and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove msort

Remove msort Configurations and Data

To remove msort configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge msort

Remove msort configuration, data, and all of its dependencies

We can use the following command to remove msort configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge msort

References

Summary

In this tutorial we learn how to install msort package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.