Команда sort

Sorts the lines in a text file.

Синтаксис

sort [-b] [-d] [-f] [-i] [-m] [-M] [-n] [-r] [-u] [+fields] filename [-o outputfile]

-bIgnores spaces at beginning of the line.
-dUses dictionary sort order and ignores the punctuation.
-fIgnores caps
-iIgnores nonprinting control characters.
-mMerges two or more input files into one sorted output.
-MTreats the first three letters in the line as a month (such as may.)
-nSorts by the beginning of the number at the beginning of the line.
-rSorts in reverse order
-uIf line is duplicated only display once
+fieldsSorts by fields , usually by tabs
filenameThe name of the file that needs to be sorted.
-o outputfileSends the sorted output to a file.

Примеры

sort -r file.txt - Would sort the file, file.txt in reverse order.

Обратно к списку команд