Name
sort
Synopsis
sort [options] [files]
Sorts the lines of the named files.
Compare specified fields for each pair of lines, or, if no fields are
specified, compare them by byte, in machine collating sequence. See
also uniq, comm, and
join.
Options
-
-b Ignore leading spaces and tabs.
-
-c Check whether
filesare already sorted, and if so, produce no output.-
-d Sort in dictionary order.
-
-f Fold; ignore uppercase/lowercase differences.
-
-i Ignore nonprinting characters (those outside ASCII range 040-176).
-
-m Merge (i.e., sort as a group) input files.
-
-n Sort in arithmetic order.
-
-ofile Put output in
file.-
-r Reverse the order of the sort.
-
-tc Separate fields with
c(default is a tab).-
-u Identical lines in input file appear only one (unique) time in output.
-
-zrecsz Provide
recszbytes for any one line in the file. This option prevents abnormal termination ofsortin certain cases.-
+n[-m] Skip
nfields before sorting, and sort up to field positionm. Ifmis missing, sort to end of line. Positions take the forma.b, which means characterbof fielda. If .bis missing, sort at the first character of the field.-
-kn[,m] Similar to +. Skip
n-1 fields and stop atm-1 fields (i.e., start sorting at thenth field, where the fields are numbered beginning with 1).-
-M Attempt to treat the first three characters as a month designation (JAN, FEB, etc.). In comparisons, treat JAN < FEB and any valid month as less than an invalid name for a month.
-
-Ttempdir Directory pathname to be used for temporary ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access