The main purpose of Sort is to sort files and data streams. The sorted result can be written to the standard output or to a specified output file.
Additionally Sort is capable of checking if a file is already sorted and it can merge two already sorted inputs into one output.
To perform the sorting, checking and merging Sort reads in entire lines and for each line it extracts one or multiple sort keys. It then sorts all lines by comparing the extracted sort keys.
How the sort keys are extracted from a line can be specified also how the sort keys are compared can be specified via command line flags.