sort Sort the contents of a text file Usage: sort + option + file name (can be followed by multiple files) Example 1: cat 1.txt sort 1.txt #text, sorted by letters az by default Example 2: cat 2.txt sort 2.txt #Numbers, sorted by 1-9 by default -n parameter: sort -n 2.txt #Add -n to sort the numbers from small to large -r parameter: sort -n -r 2.txt #-r, sort in reverse order (also applies to text) If a text has two columns, it is sorted by the first column by default. Example: cat 3.txt sort 3.txt #Default sorting is by the first column -t parameter: specify the delimiter -k parameter: specifies the column to be sorted Example: sort -t ',' -k2 3.txt #Use comma ',' as the delimiter to sort the second column Similarly: sort -t ',' -k2n 3.txt # Sort by the second column number from small to large sort -t ',' -k2nr 3.txt #Sort by the second column number from large to small Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: Detailed explanation of CocosCreator MVC architecture
>>: jQuery plugin to achieve image suspension
Diversifying website layouts is our front-end spe...
<br />Structure and hierarchy reduce complex...
The effect we need to achieve: What is needed The...
This is my first time writing a blog. I have been...
Table of contents Preface text 1. Closure 1.1 Wha...
This article shares the specific code of JS to ac...
Hyperlinks are the most frequently used HTML elem...
This article shares the specific code of Vue to r...
In this article we assume you already know the ba...
Alphabetical DTD: Indicates in which XHTML 1.0 DT...
The <base> tag specifies the default addres...
Application example website http://www.uhuigou.net...
What is a file system We know that storage engine...
Table of contents 1. Array deconstruction 2. Obje...
Nginx reverse proxy multiple servers, which means...