Detailed introduction to sort command

巴扎黑
Release: 2017-06-10 10:47:22
Original
1690 people have browsed it

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

Detailed introduction to sort command

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!