Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   sort.1p    ( 1 )

сортировать, объединять или проверять последовательность текстовых файлов (sort, merge, or sequence check text files)

Примеры (Examples)

1. The following command sorts the contents of infile with the
           second field as the sort key:

sort -k 2,2 infile

2. The following command sorts, in reverse order, the contents of infile1 and infile2, placing the output in outfile and using the second character of the second field as the sort key (assuming that the first character of the second field is the field separator):

sort -r -o outfile -k 2.2,2.2 infile1 infile2

3. The following command sorts the contents of infile1 and infile2 using the second non-<blank> of the second field as the sort key:

sort -k 2.2b,2.2b infile1 infile2

4. The following command prints the System V password file (user database) sorted by the numeric user ID (the third <colon>-separated field):

sort -t : -k 3,3n /etc/passwd

5. The following command prints the lines of the already sorted file infile, suppressing all but one occurrence of lines having the same third field:

sort -um -k 3.1,3.0 infile