Linux Command Summary --sort command

Linux sort Command

Linux command Daquan Linux command Daquan

Linux sort Command will be used to sort the contents of a text file.

sort can for the content of the text file, in units ordered.

grammar

Sort [- bcdfimMnr ] [- O <output file>] [- T <separator character>] [+ <start column> - <End field>] [- Help ] [- verison of ] [File]

Parameters :

  • -b ignore the space character in front of each line start out.
  • -C Check whether the file has been sorted in the order.
  • When -d sorting, processing letters, numbers and space characters, but ignore other characters.
  • -F When ordering, lowercase letters as uppercase letters.
  • -I When ordering, in addition to ASCII characters between 040-176, ignore the other characters.
  • -m to merge several files sorted.
  • -M The first three-letter abbreviations be sorted by month.
  • -n sorted in accordance with size values.
  • -o <output file> The results sorted into the specified file.
  • -r sorted in reverse order.
  • -t field when <separator character> Specifies the sort used separator characters.
  • + <Start column> - <End field> specified fields to sort, the range of the field from the start to the end of the previous field field.
  • --help Displays help.
  • --version display version information.

Examples

In use the sort command to the default ordering of the rows of formula file, using the following command:

sort testfile 

sort by default, will command the first row are arranged in the order of ASCII code text file, and outputs the result to standard output.

Use the cat testfile command to display the original document was understood that the sort is as follows:

CAT testfile $       #testfile original document ordering   
the Test 30 the Hello 95 Linux 85  
   

Using the result of the sort command rearranged as follows:

The Sort testfile $ # rearrangements result of   the Hello 95 Linux 85 the Test 30
   

Guess you like

Origin www.cnblogs.com/hanjiali/p/11711471.html