In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Today, the editor will bring you an article about common AWK one-line statements. The editor thinks it is very practical, so I will share it for you as a reference. Let's follow the editor and have a look.
1. END {print NR} # output total number of lines
2. NR = = 10 # output line 10
3. {print $NF} # output the last column
4. {field = $NF} END {print field} # output the last column of the last line
5. NF > 4 # output all rows with more than 4 columns in input line (this is not in action, so it is a filtering function)
6. $NF > 4 # output all rows with values greater than 4 in the last column of the input line, which is also a filter
7. All cumulative total fields of {nf = nf + NF} END {print nf} # input line
8. / Beth/ {nlines = nlines + 1} END {print nlines} # the total number of lines containing the word Beth
9. $1 > max {max = $1; maxline = $0} END {print max, maxline} # output the largest row in the first column
10. NF > 0 # field outputs non-empty lines
11. Length ($0) > 80 # filter out rows with a length of more than 80
12. {print NF, $0} # output how many columns there are in front of the line
13. {print $2, $1} # output the second column, space, and first column of each row
14. {temp = $1; $1 = $2; $2 = temp; print} # output all rows after the first and second columns swap positions
15. {$1 = NR; print} # replace the first column with the line number and output the line
16. {$2 = "; print} # clear the second column and output all rows
17. {for (I = NF; I > 0; I = I-1) printf ("% s", $I); printf ("\ n")}
# output the whole line in reverse order
18, {sum = 0; for (I = 1; I
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.