159 lines
5 KiB
Groff
159 lines
5 KiB
Groff
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1.
|
|
.TH SORT "1" "April 2025" "GNU coreutils 9.7" "User Commands"
|
|
.SH NAME
|
|
sort \- sort lines of text files
|
|
.SH SYNOPSIS
|
|
.B sort
|
|
[\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR]...
|
|
.br
|
|
.B sort
|
|
[\fI\,OPTION\/\fR]... \fI\,--files0-from=F\/\fR
|
|
.SH DESCRIPTION
|
|
.\" Add any additional description here
|
|
.PP
|
|
Write sorted concatenation of all FILE(s) to standard output.
|
|
.PP
|
|
With no FILE, or when FILE is \-, read standard input.
|
|
.PP
|
|
Mandatory arguments to long options are mandatory for short options too.
|
|
Ordering options:
|
|
.TP
|
|
\fB\-b\fR, \fB\-\-ignore\-leading\-blanks\fR
|
|
ignore leading blanks
|
|
.TP
|
|
\fB\-d\fR, \fB\-\-dictionary\-order\fR
|
|
consider only blanks and alphanumeric characters
|
|
.TP
|
|
\fB\-f\fR, \fB\-\-ignore\-case\fR
|
|
fold lower case to upper case characters
|
|
.TP
|
|
\fB\-g\fR, \fB\-\-general\-numeric\-sort\fR
|
|
compare according to general numerical value
|
|
.TP
|
|
\fB\-i\fR, \fB\-\-ignore\-nonprinting\fR
|
|
consider only printable characters
|
|
.TP
|
|
\fB\-M\fR, \fB\-\-month\-sort\fR
|
|
compare (unknown) < 'JAN' < ... < 'DEC'
|
|
.TP
|
|
\fB\-h\fR, \fB\-\-human\-numeric\-sort\fR
|
|
compare human readable numbers (e.g., 2K 1G)
|
|
.TP
|
|
\fB\-n\fR, \fB\-\-numeric\-sort\fR
|
|
compare according to string numerical value;
|
|
see full documentation for supported strings
|
|
.TP
|
|
\fB\-R\fR, \fB\-\-random\-sort\fR
|
|
shuffle, but group identical keys. See \fBshuf\fP(1)
|
|
.TP
|
|
\fB\-\-random\-source\fR=\fI\,FILE\/\fR
|
|
get random bytes from FILE
|
|
.TP
|
|
\fB\-r\fR, \fB\-\-reverse\fR
|
|
reverse the result of comparisons
|
|
.TP
|
|
\fB\-\-sort\fR=\fI\,WORD\/\fR
|
|
sort according to WORD:
|
|
general\-numeric \fB\-g\fR, human\-numeric \fB\-h\fR, month \fB\-M\fR,
|
|
numeric \fB\-n\fR, random \fB\-R\fR, version \fB\-V\fR
|
|
.TP
|
|
\fB\-V\fR, \fB\-\-version\-sort\fR
|
|
natural sort of (version) numbers within text
|
|
.PP
|
|
Other options:
|
|
.TP
|
|
\fB\-\-batch\-size\fR=\fI\,NMERGE\/\fR
|
|
merge at most NMERGE inputs at once;
|
|
for more use temp files
|
|
.TP
|
|
\fB\-c\fR, \fB\-\-check\fR, \fB\-\-check\fR=\fI\,diagnose\-first\/\fR
|
|
check for sorted input; do not sort
|
|
.TP
|
|
\fB\-C\fR, \fB\-\-check\fR=\fI\,quiet\/\fR, \fB\-\-check\fR=\fI\,silent\/\fR
|
|
like \fB\-c\fR, but do not report first bad line
|
|
.TP
|
|
\fB\-\-compress\-program\fR=\fI\,PROG\/\fR
|
|
compress temporaries with PROG;
|
|
decompress them with PROG \fB\-d\fR
|
|
.TP
|
|
\fB\-\-debug\fR
|
|
annotate the part of the line used to sort,
|
|
and warn about questionable usage to stderr
|
|
.TP
|
|
\fB\-\-files0\-from\fR=\fI\,F\/\fR
|
|
read input from the files specified by
|
|
NUL\-terminated names in file F;
|
|
If F is \- then read names from standard input
|
|
.TP
|
|
\fB\-k\fR, \fB\-\-key\fR=\fI\,KEYDEF\/\fR
|
|
sort via a key; KEYDEF gives location and type
|
|
.TP
|
|
\fB\-m\fR, \fB\-\-merge\fR
|
|
merge already sorted files; do not sort
|
|
.TP
|
|
\fB\-o\fR, \fB\-\-output\fR=\fI\,FILE\/\fR
|
|
write result to FILE instead of standard output
|
|
.TP
|
|
\fB\-s\fR, \fB\-\-stable\fR
|
|
stabilize sort by disabling last\-resort comparison
|
|
.TP
|
|
\fB\-S\fR, \fB\-\-buffer\-size\fR=\fI\,SIZE\/\fR
|
|
use SIZE for main memory buffer
|
|
.TP
|
|
\fB\-t\fR, \fB\-\-field\-separator\fR=\fI\,SEP\/\fR
|
|
use SEP instead of non\-blank to blank transition
|
|
.TP
|
|
\fB\-T\fR, \fB\-\-temporary\-directory\fR=\fI\,DIR\/\fR
|
|
use DIR for temporaries, not $TMPDIR or \fI\,/tmp\/\fP;
|
|
multiple options specify multiple directories
|
|
.TP
|
|
\fB\-\-parallel\fR=\fI\,N\/\fR
|
|
change the number of sorts run concurrently to N
|
|
.TP
|
|
\fB\-u\fR, \fB\-\-unique\fR
|
|
output only the first of lines with equal keys;
|
|
with \fB\-c\fR, check for strict ordering
|
|
.TP
|
|
\fB\-z\fR, \fB\-\-zero\-terminated\fR
|
|
line delimiter is NUL, not newline
|
|
.TP
|
|
\fB\-\-help\fR
|
|
display this help and exit
|
|
.TP
|
|
\fB\-\-version\fR
|
|
output version information and exit
|
|
.PP
|
|
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 \fB\-t\fR nor \fB\-b\fR is in
|
|
effect, characters in a field are counted from the beginning of the preceding
|
|
whitespace. OPTS is one or more single\-letter ordering options [bdfgiMhnRrV],
|
|
which override global ordering options for that key. If no key is given, use
|
|
the entire line as the key. Use \fB\-\-debug\fR to diagnose incorrect key usage.
|
|
.PP
|
|
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, R, Q.
|
|
.PP
|
|
*** 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.
|
|
.SH AUTHOR
|
|
Written by Mike Haertel and Paul Eggert.
|
|
.SH "REPORTING BUGS"
|
|
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
|
|
.br
|
|
Report any translation bugs to <https://translationproject.org/team/>
|
|
.SH COPYRIGHT
|
|
Copyright \(co 2025 Free Software Foundation, Inc.
|
|
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
|
.br
|
|
This is free software: you are free to change and redistribute it.
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|
.SH "SEE ALSO"
|
|
\fBshuf\fP(1), \fBuniq\fP(1)
|
|
.PP
|
|
.br
|
|
Full documentation <https://www.gnu.org/software/coreutils/sort>
|
|
.br
|
|
or available locally via: info \(aq(coreutils) sort invocation\(aq
|