man-pages/man1/sort.1.html
2021-03-31 01:06:50 +01:00

187 lines
6.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SORT</TITLE>
</HEAD><BODY>
<H1>SORT</H1>
Section: User Commands (1)<BR>Updated: September 2019<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sort - sort lines of text files
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>sort</B>
[<I>,OPTION/</I>]... [<I>,FILE/</I>]...
<BR>
<B>sort</B>
[<I>,OPTION/</I>]... <I>,--files0-from=F/</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
Write sorted concatenation of all FILE(s) to standard output.
<P>
With no FILE, or when FILE is -, read standard input.
<P>
Mandatory arguments to long options are mandatory for short options too.
Ordering options:
<DL COMPACT>
<DT id="1"><B>-b</B>, <B>--ignore-leading-blanks</B><DD>
ignore leading blanks
<DT id="2"><B>-d</B>, <B>--dictionary-order</B><DD>
consider only blanks and alphanumeric characters
<DT id="3"><B>-f</B>, <B>--ignore-case</B><DD>
fold lower case to upper case characters
<DT id="4"><B>-g</B>, <B>--general-numeric-sort</B><DD>
compare according to general numerical value
<DT id="5"><B>-i</B>, <B>--ignore-nonprinting</B><DD>
consider only printable characters
<DT id="6"><B>-M</B>, <B>--month-sort</B><DD>
compare (unknown) &lt; 'JAN' &lt; ... &lt; 'DEC'
<DT id="7"><B>-h</B>, <B>--human-numeric-sort</B><DD>
compare human readable numbers (e.g., 2K 1G)
<DT id="8"><B>-n</B>, <B>--numeric-sort</B><DD>
compare according to string numerical value
<DT id="9"><B>-R</B>, <B>--random-sort</B><DD>
shuffle, but group identical keys. See <A HREF="/cgi-bin/man/man2html?1+shuf">shuf</A>(1)
<DT id="10"><B>--random-source</B>=<I>,FILE/</I><DD>
get random bytes from FILE
<DT id="11"><B>-r</B>, <B>--reverse</B><DD>
reverse the result of comparisons
<DT id="12"><B>--sort</B>=<I>,WORD/</I><DD>
sort according to WORD:
general-numeric <B>-g</B>, human-numeric <B>-h</B>, month <B>-M</B>,
numeric <B>-n</B>, random <B>-R</B>, version <B>-V</B>
<DT id="13"><B>-V</B>, <B>--version-sort</B><DD>
natural sort of (version) numbers within text
</DL>
<P>
Other options:
<DL COMPACT>
<DT id="14"><B>--batch-size</B>=<I>,NMERGE/</I><DD>
merge at most NMERGE inputs at once;
for more use temp files
<DT id="15"><B>-c</B>, <B>--check</B>, <B>--check</B>=<I>,diagnose-first/</I><DD>
check for sorted input; do not sort
<DT id="16"><B>-C</B>, <B>--check</B>=<I>,quiet/</I>, <B>--check</B>=<I>,silent/</I><DD>
like <B>-c</B>, but do not report first bad line
<DT id="17"><B>--compress-program</B>=<I>,PROG/</I><DD>
compress temporaries with PROG;
decompress them with PROG <B>-d</B>
<DT id="18"><B>--debug</B><DD>
annotate the part of the line used to sort,
and warn about questionable usage to stderr
<DT id="19"><B>--files0-from</B>=<I>,F/</I><DD>
read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input
<DT id="20"><B>-k</B>, <B>--key</B>=<I>,KEYDEF/</I><DD>
sort via a key; KEYDEF gives location and type
<DT id="21"><B>-m</B>, <B>--merge</B><DD>
merge already sorted files; do not sort
<DT id="22"><B>-o</B>, <B>--output</B>=<I>,FILE/</I><DD>
write result to FILE instead of standard output
<DT id="23"><B>-s</B>, <B>--stable</B><DD>
stabilize sort by disabling last-resort comparison
<DT id="24"><B>-S</B>, <B>--buffer-size</B>=<I>,SIZE/</I><DD>
use SIZE for main memory buffer
<DT id="25"><B>-t</B>, <B>--field-separator</B>=<I>,SEP/</I><DD>
use SEP instead of non-blank to blank transition
<DT id="26"><B>-T</B>, <B>--temporary-directory</B>=<I>,DIR/</I><DD>
use DIR for temporaries, not $TMPDIR or <I>,/tmp/</I>;
multiple options specify multiple directories
<DT id="27"><B>--parallel</B>=<I>,N/</I><DD>
change the number of sorts run concurrently to N
<DT id="28"><B>-u</B>, <B>--unique</B><DD>
with <B>-c</B>, check for strict ordering;
without <B>-c</B>, output only the first of an equal run
<DT id="29"><B>-z</B>, <B>--zero-terminated</B><DD>
line delimiter is NUL, not newline
<DT id="30"><B>--help</B><DD>
display this help and exit
<DT id="31"><B>--version</B><DD>
output version information and exit
</DL>
<P>
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 <B>-t</B> nor <B>-b</B> 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 <B>--debug</B> to diagnose incorrect key usage.
<P>
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.
<P>
*** 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.
<A NAME="lbAE">&nbsp;</A>
<H2>AUTHOR</H2>
Written by Mike Haertel and Paul Eggert.
<A NAME="lbAF">&nbsp;</A>
<H2>REPORTING BUGS</H2>
GNU coreutils online help: &lt;<A HREF="https://www.gnu.org/software/coreutils/">https://www.gnu.org/software/coreutils/</A>&gt;
<BR>
Report sort translation bugs to &lt;<A HREF="https://translationproject.org/team/">https://translationproject.org/team/</A>&gt;
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright &#169; 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;<A HREF="https://gnu.org/licenses/gpl.html">https://gnu.org/licenses/gpl.html</A>&gt;.
<BR>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?1+shuf">shuf</A>(1), <A HREF="/cgi-bin/man/man2html?1+uniq">uniq</A>(1)
<P>
<BR>
Full documentation at: &lt;<A HREF="https://www.gnu.org/software/coreutils/sort">https://www.gnu.org/software/coreutils/sort</A>&gt;
<BR>
or available locally via: info '(coreutils) sort invocation'
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="32"><A HREF="#lbAB">NAME</A><DD>
<DT id="33"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="34"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="35"><A HREF="#lbAE">AUTHOR</A><DD>
<DT id="36"><A HREF="#lbAF">REPORTING BUGS</A><DD>
<DT id="37"><A HREF="#lbAG">COPYRIGHT</A><DD>
<DT id="38"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:27 GMT, March 31, 2021
</BODY>
</HTML>