sort is a very commonly used command in Linux. Each line of the file is treated as a unit and compared with each other. The comparison principle is to compare from the first character backward, according to the ASCII code value, and finally output them in ascending order. There is a file test here, the content is: 8723 23423 321324 213432 23 234 123 231 234 1234 654 3452341. The -t option and -k option of sort sort provides the -t option, and you can set the separator later, and -k to specify the number of columns. Sort the first column sort test Sort the second column sort -k 2 test If the content of the test file is changed to: 8723, 23423 321324,213432 23,234 123,231 234,1234 654,345234 If you want to sort the second column by size sort -t&n
1. Detailed explanation of the use of sort command in Linux
Introduction: sort is a very commonly used command in Linux. Each line of the file is treated as a unit and compared with each other. , the comparison principle is to compare from the first character backward, according to the ASCII code value, and finally compare them
[Related Q&A recommendations]:
linux - How does the sort command under Windows sort by value?
The above is the detailed content of Detailed introduction to sort command. For more information, please follow other related articles on the PHP Chinese website!