153 lines
6.3 KiB
Plaintext
153 lines
6.3 KiB
Plaintext
|
|
SORT(1) User Commands SORT(1)
|
|||
|
|
|
|||
|
|
NNAAMMEE
|
|||
|
|
sort - sort lines of text files
|
|||
|
|
|
|||
|
|
SSYYNNOOPPSSIISS
|
|||
|
|
ssoorrtt [_O_P_T_I_O_N]... [_F_I_L_E]...
|
|||
|
|
ssoorrtt [_O_P_T_I_O_N]... _-_-_f_i_l_e_s_0_-_f_r_o_m_=_F
|
|||
|
|
|
|||
|
|
DDEESSCCRRIIPPTTIIOONN
|
|||
|
|
Write sorted concatenation of all FILE(s) to standard output.
|
|||
|
|
|
|||
|
|
With no FILE, or when FILE is -, read standard input.
|
|||
|
|
|
|||
|
|
Mandatory arguments to long options are mandatory for short options
|
|||
|
|
too. Ordering options:
|
|||
|
|
|
|||
|
|
--bb, ----iiggnnoorree--lleeaaddiinngg--bbllaannkkss
|
|||
|
|
ignore leading blanks
|
|||
|
|
|
|||
|
|
--dd, ----ddiiccttiioonnaarryy--oorrddeerr
|
|||
|
|
consider only blanks and alphanumeric characters
|
|||
|
|
|
|||
|
|
--ff, ----iiggnnoorree--ccaassee
|
|||
|
|
fold lower case to upper case characters
|
|||
|
|
|
|||
|
|
--gg, ----ggeenneerraall--nnuummeerriicc--ssoorrtt
|
|||
|
|
compare according to general numerical value
|
|||
|
|
|
|||
|
|
--ii, ----iiggnnoorree--nnoonnpprriinnttiinngg
|
|||
|
|
consider only printable characters
|
|||
|
|
|
|||
|
|
--MM, ----mmoonntthh--ssoorrtt
|
|||
|
|
compare (unknown) < 'JAN' < ... < 'DEC'
|
|||
|
|
|
|||
|
|
--hh, ----hhuummaann--nnuummeerriicc--ssoorrtt
|
|||
|
|
compare human readable numbers (e.g., 2K 1G)
|
|||
|
|
|
|||
|
|
--nn, ----nnuummeerriicc--ssoorrtt
|
|||
|
|
compare according to string numerical value
|
|||
|
|
|
|||
|
|
--RR, ----rraannddoomm--ssoorrtt
|
|||
|
|
shuffle, but group identical keys. See shuf(1)
|
|||
|
|
|
|||
|
|
----rraannddoomm--ssoouurrccee=_F_I_L_E
|
|||
|
|
get random bytes from FILE
|
|||
|
|
|
|||
|
|
--rr, ----rreevveerrssee
|
|||
|
|
reverse the result of comparisons
|
|||
|
|
|
|||
|
|
----ssoorrtt=_W_O_R_D
|
|||
|
|
sort according to WORD: general-numeric --gg, human-numeric --hh,
|
|||
|
|
month --MM, numeric --nn, random --RR, version --VV
|
|||
|
|
|
|||
|
|
--VV, ----vveerrssiioonn--ssoorrtt
|
|||
|
|
natural sort of (version) numbers within text
|
|||
|
|
|
|||
|
|
Other options:
|
|||
|
|
|
|||
|
|
----bbaattcchh--ssiizzee=_N_M_E_R_G_E
|
|||
|
|
merge at most NMERGE inputs at once; for more use temp files
|
|||
|
|
|
|||
|
|
--cc, ----cchheecckk, ----cchheecckk=_d_i_a_g_n_o_s_e_-_f_i_r_s_t
|
|||
|
|
check for sorted input; do not sort
|
|||
|
|
|
|||
|
|
--CC, ----cchheecckk=_q_u_i_e_t, ----cchheecckk=_s_i_l_e_n_t
|
|||
|
|
like --cc, but do not report first bad line
|
|||
|
|
|
|||
|
|
----ccoommpprreessss--pprrooggrraamm=_P_R_O_G
|
|||
|
|
compress temporaries with PROG; decompress them with PROG --dd
|
|||
|
|
|
|||
|
|
----ddeebbuugg
|
|||
|
|
annotate the part of the line used to sort, and warn about ques-
|
|||
|
|
tionable usage to stderr
|
|||
|
|
|
|||
|
|
----ffiilleess00--ffrroomm=_F
|
|||
|
|
read input from the files specified by NUL-terminated names in
|
|||
|
|
file F; If F is - then read names from standard input
|
|||
|
|
|
|||
|
|
--kk, ----kkeeyy=_K_E_Y_D_E_F
|
|||
|
|
sort via a key; KEYDEF gives location and type
|
|||
|
|
|
|||
|
|
--mm, ----mmeerrggee
|
|||
|
|
merge already sorted files; do not sort
|
|||
|
|
|
|||
|
|
--oo, ----oouuttppuutt=_F_I_L_E
|
|||
|
|
write result to FILE instead of standard output
|
|||
|
|
|
|||
|
|
--ss, ----ssttaabbllee
|
|||
|
|
stabilize sort by disabling last-resort comparison
|
|||
|
|
|
|||
|
|
--SS, ----bbuuffffeerr--ssiizzee=_S_I_Z_E
|
|||
|
|
use SIZE for main memory buffer
|
|||
|
|
|
|||
|
|
--tt, ----ffiieelldd--sseeppaarraattoorr=_S_E_P
|
|||
|
|
use SEP instead of non-blank to blank transition
|
|||
|
|
|
|||
|
|
--TT, ----tteemmppoorraarryy--ddiirreeccttoorryy=_D_I_R
|
|||
|
|
use DIR for temporaries, not $TMPDIR or _/_t_m_p; multiple options
|
|||
|
|
specify multiple directories
|
|||
|
|
|
|||
|
|
----ppaarraalllleell=_N
|
|||
|
|
change the number of sorts run concurrently to N
|
|||
|
|
|
|||
|
|
--uu, ----uunniiqquuee
|
|||
|
|
with --cc, check for strict ordering; without --cc, output only the
|
|||
|
|
first of an equal run
|
|||
|
|
|
|||
|
|
--zz, ----zzeerroo--tteerrmmiinnaatteedd
|
|||
|
|
line delimiter is NUL, not newline
|
|||
|
|
|
|||
|
|
----hheellpp display this help and exit
|
|||
|
|
|
|||
|
|
----vveerrssiioonn
|
|||
|
|
output version information and exit
|
|||
|
|
|
|||
|
|
KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where
|
|||
|
|
F is a field number and C a character position in the field; both are
|
|||
|
|
origin 1, and the stop position defaults to the line's end. If neither
|
|||
|
|
--tt nor --bb is in effect, characters in a field are counted from the
|
|||
|
|
beginning of the preceding whitespace. OPTS is one or more single-let-
|
|||
|
|
ter ordering options [bdfgiMhnRrV], which override global ordering
|
|||
|
|
options for that key. If no key is given, use the entire line as the
|
|||
|
|
key. Use ----ddeebbuugg to diagnose incorrect key usage.
|
|||
|
|
|
|||
|
|
SIZE may be followed by the following multiplicative suffixes: % 1% of
|
|||
|
|
memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
|
|||
|
|
|
|||
|
|
*** WARNING *** The locale specified by the environment affects sort
|
|||
|
|
order. Set LC_ALL=C to get the traditional sort order that uses native
|
|||
|
|
byte values.
|
|||
|
|
|
|||
|
|
AAUUTTHHOORR
|
|||
|
|
Written by Mike Haertel and Paul Eggert.
|
|||
|
|
|
|||
|
|
RREEPPOORRTTIINNGG BBUUGGSS
|
|||
|
|
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
|
|||
|
|
Report sort translation bugs to <https://translationproject.org/team/>
|
|||
|
|
|
|||
|
|
CCOOPPYYRRIIGGHHTT
|
|||
|
|
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU
|
|||
|
|
GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
|||
|
|
This is free software: you are free to change and redistribute it.
|
|||
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|||
|
|
|
|||
|
|
SSEEEE AALLSSOO
|
|||
|
|
shuf(1), uniq(1)
|
|||
|
|
|
|||
|
|
Full documentation at: <https://www.gnu.org/software/coreutils/sort>
|
|||
|
|
or available locally via: info '(coreutils) sort invocation'
|
|||
|
|
|
|||
|
|
GNU coreutils 8.29 December 2017 SORT(1)
|