In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use pipe symbols in Linux shell". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use pipe symbols in Linux shell.
Pipe symbol, is a very powerful function of unix, the symbol is a vertical bar: "|".
Usage: command 1 | command 2 his function is to pass the result of the first command command 1 to command 2 as input to command 2, for example:
$ls-s | sort-nr (please be careful not to copy the $symbol into it)
-s is file size,-n, numeric-sort,-r is reverse, reverse
This command lists the documents in the current directory (including size) and sends the output to the sort command as input, and the sort command sorts the output of ls in descending order.
$ls-s | sort-n
Output in order from small to large.
Of course, you can also carry out many operations, such as the following function is to remove pure numbers, and then sed will replace the vertical bar (here is not a pipe symbol) with a space, and then take out the results to sort, and then select the results to display, do not understand can view sorting and paging.
Cat filename | grep-v'^ [0-9] * $'| sed's / | / / g' | sort-nrk 8-nrk 9 | tail-n + 1 | head-n 10
Thank you for reading, the above is the content of "how to use pipe symbols in Linux shell". After the study of this article, I believe you have a deeper understanding of how to use pipe symbols in Linux shell, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.