In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail about the use of awk command text and data processing linux programming language, Xiaobian feel quite practical, so share to you as a reference, I hope you can read this article after harvest.
The awk command is a programming language for processing text and data under linux/unix.
And it supports user-defined functions and dynamic regular expressions and other advanced features, linux/unix is a powerful programming tool.
Syntax format: awk [parameter] [file]
Common parameters:
-F Specify field delimiters to use when entering-v Custom variables-f Read awk command from script-m Set inherent limits on val values
Reference Example
Print the second and third fields of each line:
[root@linuxcool ~]# awk '{ print $2,$3 }' file
Modify the output separator symbol, special characters need to escape:
[root@linuxcool ~]# awk -v OFS="~"'{print $1,$NF}' demo.txt Welcome~blog. This~file.
Output passwd characters in a specific format:
[root@linuxcool ~]# awk -F: '{printf "%-15s->s ->%20s\n",$1,$(NF-3),$NF}' /etc/passwd|head -2
Print the first field of the line with uid greater than or equal to 500 and beginning with m on the system:
[root@linuxcool ~]# awk -F: '$3>=500 && $1 ~ /^m/{print $1}' /etc/passwd
The third field has zero print, and zero only, fuzzy match and exact match:
[root@linuxcool ~]# awk-F: '$3~0{print}'/etc/passwd About the use of awk command text and data processing programming language shared here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.
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.