I '
SORT
Chapter 6 / Command
Refere17£e
External
I'
I
r-'
I
r:
L '
r--;
I
,
SORT [lR] [I +
n]
[<input
pathname]
[>output
pathname]
SORT is a filter
that
reads
input
from
the
standard
input
device,
sorts
the
data, and writes
it
to
the
standard
output device.
Parameters
<input
pathname specifies
the
file to be sorted.
If
you omit
this
parameter, SORT sorts keyboard input.
>output pathname specifies
the
file to receive the sorted infor-
mation.
If
you omit
this
parameter, SORT sends
the
output to
the
display.
/R reverses
the
sort (sorts from Z to
A).
If
you omit
this
parame-
ter,
the
sort is from A to
Z.
/+n begins
the
sort
at
Column
n.
If
you omit
this
parameter,
the
sort begins
at
Column
1.
Notes
and
Suggestions
• Use SORT to alphabetize a file
by
a certain column. Suppose
you have
this
information in a file, Mail.dat,
on
the
current
drive.
Janet
King
Samuel Beck
Sal Cleo
28th
St.
46th
St.
79th
St.
Li'ncoln
Rapid City
Ft. Worth
NE 68502
SD 57001
TX 76133
f'
I
r
I '
r
i
To
sort the file alphabetically, according to
last
name, and
then store the sorted output
in
another file, type:
sort
/+2
<mail.dat>sortmail.dat
I
ENTER
I
SORT sorts the contents of Mail.dat,
starting
at
Column
2,
and outputs
the
sorted
data
into
the
file Sortmail.dat.
173