home *** CD-ROM | disk | FTP | other *** search
- NAME
- sort - sort or merge files
-
- SYNTAX
- sort [-bfnr] [+pos1 [-pos2]] [-o name] [-t path] [file_list]
-
- DESCRIPTION
- Sort sorts lines of all the named files together and writes the result
- on the standard output. The name `-' means the standard input. If no
- input files are named, the standard input is sorted.
-
- The default sort key is an entire line. Default ordering is lexicographic
- by bytes. The ordering is affected globally by the following options, one
- or more of which may appear.
-
- b Ignore leading blanks (spaces and tabs) in field comparisons.
-
- f Fold upper case letters onto lower case.
-
- n An initial numeric string, consisting of optional blanks, optional
- minus sign, and zero or more digits with optional decimal point, is
- sorted by arithmetic value. Option n implies option b.
-
- r Reverse the sense of comparisons.
-
- The notation +pos1 -pos2 restricts a sort key to a field beginning at
- pos1 and ending just before pos2. Pos1 and pos2 each have the form m.n
- where m tells a number of fields to skip from the beginning of the line
- and n tells a number of characters to skip further. A missing .n means .0;
- a missing -pos2 means the end of the line. Fields are nonempty nonblank
- strings separated by blanks, where blanks include the characters SP and HT
- (' ' and ^I).
-
- When there are multiple sort keys, later keys are compared only after all
- earlier keys compare equal. Lines that otherwise compare equal are ordered
- with all bytes significant.
-
- These option arguments are also understood:
-
- o The next argument is the name of an output file to use instead of the
- standard output. This file may be the same as one of the inputs.
-
- t The next argument is the name of a path (drive, directory) in which
- temporary files should be made. Temporary files will only be created
- when the number of input lines exceed 1000 lines.
-
- EXAMPLES
- Print in alphabetical order a list of words. Capitalized words are grouped
- with uncapitalized words.
-
- sort -bf list
-
- Print in reverse numerical order (large numbers first) a directory
- listing.
-
- ls -s | sort -nr +1
-
- FILES
- Temporary files have the name sorttemp.xxx where xxx is a number from 0 to
- 999. These files are deleted if sort successfully completes (i.e. if the
- user doesn't interrupt the program).
-
- SEE ALSO
- uniq, comm, rev