aboutsummaryrefslogtreecommitdiff
path: root/pkg/system/doc/sort.hlp
blob: 7d89657bfbd82cfca643b1ec8518c9b0f20ac9e5 (plain) (blame)
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
.help sort Mar87 system
.ih
NAME
sort -- sort a file or the standard input
.ih
USAGE
sort input_file
.ih
PARAMETERS
.ls input_file
The text file to be sorted.  If the standard input is redirected the standard
input is sorted.
.le
.ls column = 0
If 0, sort entire text lines, else sort based on data/text starting
in the specified column.  Columns are delimited by whitespace.  Thus,
.nf
	12   abc   34   56
.fi
has four columns, "abc" being in the second.
.le
.ls ignore_whitespace = no
Ignore leading whitespace.  Useful only when column = 0 and the sort is
non-numeric.
.le
.ls numeric_sort = no
If set, make numerical (rather than ASCII text) comparisons.
.le
.ls reverse_sort = no
If set, sort in reverse text/numeric order.
.le
.ih
DESCRIPTION
\fISort\fR sorts the contents of the given text file, or the
standard input, either on a textual (based on the ASCII collating
sequence), or on a numeric basis.  If a numeric sort is requested,
and either field in any comparison is non-numeric, a string (ASCII)
comparison will be made instead.
.ih
EXAMPLES

1. Sort the output of the set command into alphabetic (ASCII collating)
order.

	cl> set | sort

2. Sort the contents of "file", in reverse ASCII order, ignoring the
contents of columns 1 through 4.

	cl> sort file rev+ col=5

3. Print a long form directory listing with the files sorted by size,
largest files first.

	cl> dir | sort num+ rev+ col=3
.ih
BUGS
Only one file can be sorted per call, and only one column or all columns can
be used for the sort.  The current program is inefficient for large numeric
sorting tasks because the same numeric field may be decoded into its
corresponding binary value many times.
.endhelp