Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN

Reference: sort

UNIX in a Nutshell: System V Edition

 

sort

sort [options] [files]
-b
-c
-d
-f
-i

Ignore nonprinting characters (those outside ASCII range 040-176).

-k fieldspec

Specify significance of input fields for sorting. See the fuller description below. Solaris only.

-m
-M
-n
-o file
-r

Reverse the order of the sort.

-tc

Fields are separated with c (default is any whitespace).

-T dir
-u
-y[kmem]
-zrecsz
+n [-m]

Skip n fields before sorting, and sort up to field position m. If m is missing, sort to end of line. Positions take the form a.b, which means character b of field a. If .b is missing, sort at the first character of the field. Counting starts at zero. Solaris allows fields to have optional trailing modifiers, as in the -k option.

Field Specifications for -k

A fieldspec has the form fieldstart[type][,fieldend[type]].

fieldstart
fieldend
type

Examples

wc -l * | sort -rn

Alphabetize a list of words, remove duplicates, and print the frequency of each word:

sort -fd wordlist | uniq -c

Sort the password file numerically by the third field (user ID):

sort +2n -t: /etc/passwd
cd /home; du -sk * | sort -nr | head -20

Previous: Reference: soelim UNIX in a Nutshell: System V Edition Next: Reference: sortbib
Reference: soelim Book Index Reference: sortbib

The UNIX CD Bookshelf Navigation
Copyright © 2009-2023 UrgentHomework.com, All right reserved.