tsort - topological sort
tsort [file]
The tsort command produces on the standard output a totally ordered list of items consistent with a partial ordering of items mentioned in the input file.
The input consists of pairs of items (non-empty strings) separated by blanks. Pairs of different items indicate ordering. Pairs of identical items indicate presence, but not ordering.
The following operand is supported:
A path name of a text file to order. If no file operand is given, the standard input is used.
The command:
example% tsort <<EOF a b c c d e g g f g e f EOF
produces the output:
a b c d e f g
See environ(7) for descriptions of the following environment variables that affect the execution of tsort: LANG, LC_ALL , LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned:
Successful completion.
An error occurred.
See attributes(7) for descriptions of the following attributes:
|
lorder(1), attributes(7), environ(7), standards(7)
Odd data: there are an odd number of fields in the input file.