1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
.help tsort Dec90 tables
.ih
NAME
tsort -- Sort a table on one or more columns.
.ih
USAGE
tsort table columns
.ih
DESCRIPTION
This task sorts an STSDAS-format table. The sort is done in place, so if you want
to keep a copy of the unsorted table, you should copy it with the 'tcopy'
task before you
do the sort. The column, or columns, on which to sort are specified
using the parameter
'columns', which is a list of column names, or column name templates,
separated by
commas. The most significant column name is the first in the list---the
column whose values are sorted; subsequent
columns are used only to break ties. There are two flags, 'ascend' and
'casesens'. The 'ascend' parameter determines whether the sort is done
in ascending or descending order, if
'ascend = yes', the first row in the output table holds the lowest value (if
the sorted column is numeric) or the first string in alphabetic order (if the
sorted column is a character string). If 'casesens = yes', upper
case characters
precede lower case characters. Otherwise, case is not significant
in determining the sort order. When sorting a boolean column, "no" precedes
"yes". Null table elements are always last in the sort, regardless
of the value of 'ascend'.
.ih
PARAMETERS
.ls table [file name template]
Name of the table, or tables, to be sorted in-place.
All tables are sorted on the same column or columns; if more than one table
is specified all tables must have the column(s) specified by the 'columns'
parameter.
.le
.ls columns [string]
Column name or column name template describing columns on which sort will
be performed. A column name template consists of a list of
column names, or column patterns containing wildcard characters.
Individual column names, or templates, are separated by commas or white space.
The list of columns can be placed in a file and the name of the
file passed to 'columns' (preceded by a
"@" character).
.le
.ls (ascend = yes) [boolean]
Sort the table in ascending order? If you want the table sorted in descending
order, set 'ascend = no'.
.le
.ls (casesens = yes) [boolean]
Are sorts on character columns to be case sensitive? If 'casesens = yes',
upper case letters will precede lower case letters. If 'casesens = no',
case is ignored by the sort operation.
.ls
.ih
EXAMPLES
1. Sort a table of star positions by right ascension and declination:
.nf
tt> tsort starcat.tab ra,dec
.fi
2. Sort a phone list. Make the sort case insensitive:
.nf
tt> tsort phone.tab lname,fname case-
.fi
3. Sort a star catalog so that all binary stars (i.e., a boolean column
named 'binary') are first:
.nf
tt> tsort starcat.tab binary asc-
.fi
.ih
BUGS
.ih
REFERENCES
This task was written by Bernie Simon.
.ih
SEE ALSO
tcopy
.endhelp
|