asort - Sorts or merges files and supports multiple collating weight sequences
asort [-m] [-o output_file] [-Abdfinruv] [-Ccollate_sequence] [-k keydef]... [-t character] [-T directory] [-y][kilobytes] [-z record_size]... file...
asort -c [-u] [-Abdfinruv] [-Ccollate_sequence] [-k keydef]... [-t character] [-T directory] [-y][kilobytes] [-z record_size]... file...
The following syntax is maintained for backward compatibility but may be withdrawn in a future release: asort [-Abcdfimnruv] [-Ccollate_sequence] [-o output_file] [-t character] [-T directory] [-y][kilobytes] [-z record_size] [+fskip][.cskip] [-fskip][.cskip] [-bdfinr]... file...
The asort command includes the same options as the sort command (see sort(1)) in addition to the following options: Specifies the collating weight sequence to be used in sorting the data files. When this option is specified, the asort command does not use the collating table from the locale database. Instead, the command uses a set of special system and user collating tables to determine the collating weights of characters, including user-defined characters (UDCs).
The asort command sorts lines in its input files and writes the result to standard output. The asort command is similar to the sort command. See the sort(1) reference page for information about features the two commands have in common.
The asort command provides additional features for processing multiple collating weight sequences used with Asian languages, such as Chinese. For example, pinyon (p), stroke (s), and radical (r) are three dimensions along which characters can be ordered in Simplified Chinese. The -C option allows users to specify the priority level that these dimensions have during sorting. For example, -C srp specifies that characters should be sorted first by stroke, then by radical, then by pinyon. The specified sequence is applied to user-defined characters (UDCs) as well as to standard characters.
When the -C option is specified, the default behavior of the asort command is to use a depth-first sorting mechanism to sort the input files. With the depth-first mechanism, pairs of multibyte characters in a sort field are compared by exhausting all the specified collating weights and/or internal codes one at a time until the collating order is resolved. Only when two characters are identical is the next pair of characters compared. The depth-first sorting mechanism is also called character sorting.
command provides the
option to use the Asian VMS-like breadth-first sorting mechanism.
With the breadth-first mechanism, pairs of multibyte characters in a sort
field are compared using the first collating weight for all the characters
in the sort field first. Only when two sets of data in a sort field are computed
to have the same collating order are succeeding collating weights used for
resolving the collating order. The breadth-first sorting mechanism is sometimes
called string sorting.
command is supported for use
only with Chinese codesets.
command returns the following exit values:
All input files were output successfully, or
was specified and the input file was correctly sorted.
was specified, the file was not ordered
as specified, or if the
both specified, two input lines were found with equal keys.
An error occurred.
Unless stated otherwise, the following examples assume the locale setting is zh_TW.dechanyu: To perform character sorting first by stroke and then by radical, enter: asort -C"Stroke Radical" names
Others: Chinese(5), i18n_intro(5)