In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the use of awk basic programming examples of Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Awk is a very widely used text processing tool, is one of the most powerful data processing engines, can carry out style loading, flow control, mathematical operators, process control statements and even built-in variables and functions, down to a detailed introduction of its basic users show, and share with you!
1.awk reads a row of data each time, if the-F option is set, the delimiter is used on this line, and $0 is all.
2.awk consists of patterns and actions
3. Conditional judgment mode {Action}
A.txtaaabbbaaacccdddcat a.txt | awk'$1percent = "aaa" {print "= =" $1}'
4 / regular mode / {Action}
There can be multiple modal actions
5. Conditional operator, ~ match regular! ~ mismatch
Cat a.txt | awk'{if ($1 situation = "aaa") print $1 position else print "= =" $1}'
6. A special mode (BEGIN,END) is executed only once, unlike the previous mode, where each line is executed for initialization, printing of the final result, etc.
Cat a.txt | awk'{arr [$1] + = 1} END {for (row in arr) {print row "occurrences" arr [row]}'
Match array to count the number of occurrences
On the use of Linux awk basic programming examples to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.