sorttable - sort an ASCII tab table on specified columns.
SYNOPSYS
sorttable [options] [keycolumn[:flags]] [keycolumn[:flags]] ...
OPTIONS
Program Options
- -i file
- input file.
- -o file
- output file.
- -D
- print out the intended arvg just before calling sort.
- -c
- Check whether the given files are already sorted: if
they are not all sorted, print an error message and
exit with a status of 1.
- -u
- For the default case or the -m option, only output the
first of a sequence of lines that compare equal. For
the -c option, check that no pair of consecutive lines
compares equal.
- -d
- Print only lines that are duplicates.
- -U
- Print only the first of lines that compare equal.
- -m
- merge sorted files.
- -c
- check sorted file.
Sort Options
- -b
- skip initial blank space (note that trailing whitespace is
always skipped in sorttable).
- -d
- Sort in `phone directory' order: ignore all characters
except letters, digits and blanks when sorting.
- -F
- Fold lower case characters into the equivalent upper
case characters when sorting so that, for example, `b'
is sorted the same way `B' is.
- -I
- Ignore characters outside the ASCII range 040-0176
octal (inclusive) when sorting.
- -M
- An initial string, consisting of any amount of white
space, followed by three letters abbreviating a month
name, is folded to UPPER case and compared in the order
`JAN' < `FEB' < ... < `DEC.' Invalid names compare low
to valid names.
- -a
- Compare using the ASCII collating sequence.
- -n
- Compare according to arithmetic value. an initial
numeric string consisting of optional white space, an
optional - sign, and zero or more digits, optionally
followed by a decimal point and zero or more digits.
- -h
- Like -n except sexagasmal values are allowed (HH:MM:SSS.SS etc).
- -r
- Reverse the result of comparison, so that lines with
greater key values appear earlier in the output instead
of later.
COLUMN FLAGS
Any of the above sort options may be supplied for specific columns
by suffixing the column with a sort flag. Sort flags are introduced
by the colon character (":"). Several flags may be given. The flags
affect only that column.
In addition a specific subset of characters in a key column may be
selected is the sort key with the column range modifier.
To sort file on column XXX characters 3 through 5 inclusive.
sorttable XXX.3-5 file
DESCRIPTION
sorttable uses the unix sort program to sort an ASCII tab table.
A pair of lines is compared as follows: if any key fields
have been specified, sort compares each pair of fields, in
the order specified on the command line, according to the
associated ordering options, until a difference is found or
no fields are left.
If any of the program options Mbdfhinr are given but no key
fields are specified, sort compares the entire lines according
to the global options.
SEE ALSO
- jointable
- join two ASCII tab tables on matching key columns.
- sort
- sort lines of text.
- starbase.1
- ASCII tab tables introduction.
NOTES
The gnu sort program provided with the tables package has been
enhanced to allow numeric values in sexagasmal format.