sort man page on 4.4BSD

Man page or keyword search:  
man Server   1065 pages
apropos Keyword Search (all sections)
Output format
4.4BSD logo
[printable version]

SORT(1)			  BSD General Commands Manual		       SORT(1)

NAME
     sortsort or merge text files

SYNOPSIS
     sort [-mubdfinrtx] [+pos1 [-pos2]] ... [-o output] [-T directory] [file]
	  ...

DESCRIPTION
     The sort utility sorts text files by lines.  Comparisons are based on one
     or more sort keys (or fields) extracted from each line of input, and are
     performed lexicographically. By default, if keys are not given, sort
     regards each input line as a single field.

     The following options are available:

     -c	     Check that the single input file is sorted lexicographically.  If
	     the file is not sorted, sort sorts it and writes the sorted out‐
	     put to the standard output or the filename specified by the -o
	     option.

     -m	     Merge only; the input files are assumed to be pre-sorted.

     -o output
	     The argument given is the name of an output file to be used
	     instead of the standard output.  This file can be the same as one
	     of the input files.

     -T directory
	     The argument directory is used for creating temporary files.

     -u	     Unique: suppress all but one in each set of lines having equal
	     keys.  If used with the -c option, check that there are no lines
	     with duplicate keys.

     The following options override the default ordering rules.	 When ordering
     options appear independent of key field specifications, the requested
     field ordering rules are applied globally to all sort keys.

     -d	     Only blank space and alphanumeric characters are used in making
	     comparisons.

     -f	     Considers all lowercase characters that have uppercase equiva‐
	     lents to be the same for purposes of comparison.

     -i	     Ignore all non-printable characters.

     -n	     An initial numeric string, consisting of optional blank space,
	     optional minus sign, and zero or more digits (including decimal
	     point) is sorted by arithmetic value.  The -n option implies the
	     -b option. (See below.)  Note that the -b option is only effec‐
	     tive when key fields have been specified and that -0 is consid‐
	     ered equal to zero.

     -r	     Reverse the sense of comparisons.

     The treatment of field separators can be altered using the options:

     -b	     Leading blank spaces are ignored when determining the starting
	     ending positions of a restricted sort key.	 If the -b option is
	     specified before the first +pos1 argument, it shall be applied to
	     all +pos1 arguments.  Otherwise, the -b option can be attached
	     independently to each +pos1 or -pos2 argument (see below).

     -t char
	     Char is used as the field separator character; char is not con‐
	     sidered to be part of a field (although it can be included in a
	     sort key).	 Each occurrence of char is significant (for example,
	     “charchar” delimits an empty field).  If -t is not specified,
	     blank space characters are used as default field separators.

     +pos1   Designates the start position of a key field.

     -pos1   Designates the end position of a key field.

     The following operands are available:
     file The pathname of a file to be sorted, merged, or checked.  If no file
     operands are specified, or if a file operand is -, the standard input is
     used.

     A field is defined as a minimal sequence of characters followed by a
     field separator or a newline character.  By default, the first blank
     space of a sequence of blank spaces acts as the field separator.  All
     blank spaces in a sequence of blank spaces are considered to be part of
     the next field; for example, all blank spaces at the beginning of a line
     are considered to be part of the first field.

     Fields are specified by the +pos1 and -pos2 arguments.  A missing +pos1
     argument defaults to the beginning of a line.  A missing -pos2 argument
     defaults to the end of a line.

     The arguments +pos1 and -pos2 have the form m.n followed by one or more
     of the options -b, -d, -f, -i, -n, -r.  A +pos1 position specified by m.n
     is interpreted to mean the nth character in the m+1th field.  A missing
     .n means ‘.0’, indicating the first character of the m+1th field.	If the
     -b option is in effect, n is counted from the first non-blank character
     in the m+1th field; m.0b refers to the first non-blank character in the
     m+1th field.

     A -pos2 position specified by m.n is interpreted to mean the nth charac‐
     ter (including separators) after the last character of the mth field.  A
     missing .n means ‘.0’, indicating the last character of the mth field.
     If the -b option is in effect, n is counted from the last leading blank
     character in the m+1th field; m.1b refers to the first non-blank charac‐
     ter in the m+1th field.

FILES
     /var/tmp/stm*, /tmp/*	       Default temporary directories (in order
				       of search).

SEE ALSO
     comm(1), uniq(1), join(1)

DIAGNOSTICS
BUGS
     Lines which are longer than 4096 are discarded and processing continues.

HISTORY
     A sort command appeared in Version 6 AT&T UNIX.

BSD				  May 4, 1995				   BSD
[top]

List of man pages available for 4.4BSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net