124 lines
2.6 KiB
HTML
124 lines
2.6 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>sort(1)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>sort(1)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
sort - sort a file of ASCII lines
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>sort</STRONG> [<STRONG>-bcdfimnru</STRONG>] [<STRONG>-t</STRONG><EM>c</EM>] [<STRONG>-o</STRONG> <EM>name</EM>] [<STRONG>+</STRONG><EM>pos1</EM>] [<STRONG>-</STRONG><EM>pos2</EM>] <EM>file</EM> ...
|
|
|
|
|
|
</PRE>
|
|
<H2>OPTIONS</H2><PRE>
|
|
|
|
<STRONG>-b</STRONG> Skip leading blanks when making comparisons
|
|
|
|
<STRONG>-c</STRONG> Check to see if a file is sorted
|
|
|
|
<STRONG>-d</STRONG> Dictionary order: ignore punctuation
|
|
|
|
<STRONG>-f</STRONG> Fold upper case onto lower case
|
|
|
|
<STRONG>-i</STRONG> Ignore nonASCII characters
|
|
|
|
<STRONG>-m</STRONG> Merge presorted files
|
|
|
|
<STRONG>-n</STRONG> Numeric sort order
|
|
|
|
<STRONG>-o</STRONG> Next argument is output file
|
|
|
|
<STRONG>-r</STRONG> Reverse the sort order
|
|
|
|
<STRONG>-t</STRONG> Following character is field separator
|
|
|
|
<STRONG>-u</STRONG> Unique mode (delete duplicate lines)
|
|
|
|
|
|
</PRE>
|
|
<H2>EXAMPLES</H2><PRE>
|
|
|
|
<STRONG>sort</STRONG> <STRONG>-nr</STRONG> <STRONG>file</STRONG> # Sort keys numerically, reversed
|
|
|
|
<STRONG>sort</STRONG> <STRONG>+2</STRONG> <STRONG>-4</STRONG> <STRONG>file</STRONG> # Sort using fields 2 and 3 as key
|
|
|
|
<STRONG>sort</STRONG> <STRONG>+2</STRONG> <STRONG>-t:</STRONG> <STRONG>-o</STRONG> <STRONG>out</STRONG> # Field separator is :
|
|
|
|
<STRONG>sort</STRONG> <STRONG>+.3</STRONG> <STRONG>-.6</STRONG> # Characters 3 through 5 form the key
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
|
|
<EM>Sort</EM> sorts one or more files. If no files are specified, <EM>stdin</EM> is
|
|
sorted. Output is written on standard output, unless <STRONG>-o</STRONG> is specified.
|
|
The options <STRONG>+</STRONG><EM>pos1</EM> <STRONG>-</STRONG><EM>pos2</EM> use only fields <EM>pos1</EM> up to but not including <EM>pos2</EM>
|
|
as the sort key, where a field is a string of characters delimited by
|
|
spaces and tabs, unless a different field delimiter is specified with <STRONG>-t</STRONG>.
|
|
Both <EM>pos1</EM> and <EM>pos2</EM> have the form <EM>m</EM>.<EM>n</EM> where <EM>m</EM> tells the number of fields
|
|
and <EM>n</EM> tells the number of characters. Either <EM>m</EM> or <EM>n</EM> may be omitted.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man1/comm.1.html">comm(1)</A></STRONG>, <STRONG><A HREF="../man1/grep.1.html">grep(1)</A></STRONG>, <STRONG><A HREF="../man1/uniq.1.html">uniq(1)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|