In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to use the sort text processing command in Linux. It is concise and easy to understand. It will definitely make your eyes shine. I hope you can gain something from the detailed introduction of this article.
sort Sort the contents of a text file
Usage: sort + option + filename (can be followed by multiple files)
Example 1: cat 1.txt
sort 1.txt #text, sorted by letters a-z by default
Example 2: cat 2.txt
sort2.txt #Numbers, sorted by default from 1-9
-n argument: sort -n 2.txt #plus-n, sort numbers from small to large
-r parameter: sort -n -r 2.txt #-r , reverse sort (also applies to text)
If a text has two columns of content, the default is sorted by the first column. Example: cat3.txt
sort3.txt #Sort by first column by default
-t parameter: specify delimiter
-k parameter: specifies the column to sort
Example: sort -t ',' -k2 3.txt #Sort the second column with comma ',' as separator
sort -t ',' -k2n 3.txt #Sort by the second column from smallest to largest
sort -t ',' -k2nr 3.txt #Sort by second column numbers from largest to smallest
Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.
That's how to use the sort text processing command in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.