|
Quick links About
sort Syntax Examples
Related commands Unix main page
About sort
Sorts the lines in a text file.
Syntax
sort [-b] [-d] [-f] [-i] [-m] [-M] [-n] [-r] [-u] [+fields] filename
[-o outputfile]
| -b |
Ignores spaces at beginning of the line. |
| -d |
Uses dictionary sort order and ignores the punctuation. |
| -f |
Ignores caps |
| -i |
Ignores nonprinting control characters. |
| -m |
Merges two or more input files into one sorted output. |
| -M |
Treats the first three letters in the line as a month (such as may.) |
| -n |
Sorts by the beginning of the number at the beginning of the line. |
| -r |
Sorts in reverse order |
| -u |
If line is duplicated only display once |
| +fields |
Sorts by fields , usually by tabs |
| filename |
The name of the file that needs to be sorted. |
| -o outputfile |
Sends the sorted output to a file. |
Examples
sort -r file.txt - Would sort the file,
file.txt in reverse order.
Related commands
comm
join uniq
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|