当前位置:网站首页>Awk from entry to soil (5) simple condition matching
Awk from entry to soil (5) simple condition matching
2022-07-04 08:46:00 【Wonderful binary】
We have been talking about ,awk The usage syntax of is as follows ( I think you are already familiar with ):
awk [options] ‘pattern {Action}’ file1 file2 ···
about options( Options ) for , We used it -F Options , Also used -v Options .
about Action( action ) for , We used it print And printf, Later in the article , We will also be right Action Summarize .
about Pattern( Pattern ) for , We are just beginning to learn awk when , Two special modes are introduced ,BEGIN Patterns and END Pattern , however , We don't have a detailed introduction ” Pattern ” What is it? , How to use it? , And here , We will introduce in detail awk The pattern in .
“ Pattern ” This word sounds very literary , It's not particularly easy to understand , Let's put it another way , We put ” Pattern ” Switch to ” Conditions ”, Maybe easier to understand , that ” Conditions ” What does that mean ? We know ,awk It processes text line by line , in other words ,awk Will deal with the current line first , Process the next line , If we don't specify any ” Conditions ”,awk Each line in the text will be processed line by line , If we specify ” Conditions ”, Only satisfaction ” Conditions ” The row will be processed , dissatisfaction ” Conditions ” The row will not be processed . Is that a little easier to understand than just now ? This is actually awk Medium ” Pattern ”.
Again , When awk When processing line by line , Will be able to pattern( Pattern ) As a condition , Judge whether the row to be processed meets the conditions , Can you follow ” Pattern ” Match , If the match , Then deal with , If it doesn't match , Do not deal with .
Take a small example &
边栏推荐
- HMS core helps baby bus show high-quality children's digital content to global developers
- Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
- The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
- Educational Codeforces Round 115 (Rated for Div. 2)
- yolov5 xml数据集转换为VOC数据集
- Show server status on Web page (on or off) - PHP
- ES6 summary
- 没有Kubernetes怎么玩Dapr?
- How to set multiple selecteditems on a list box- c#
- How to solve the problem that computers often flash
猜你喜欢
What if I forget the router password
Collections in Scala
awk从入门到入土(12)awk也可以写脚本,替代shell
DM8 database recovery based on point in time
HMS core helps baby bus show high-quality children's digital content to global developers
1. Getting started with QT
1. Kalman filter - the best linear filter
What should I do if there is a problem with the graphics card screen on the computer
OpenFeign 服务接口调用
Question 49: how to quickly determine the impact of IO latency on MySQL performance
随机推荐
[error record] no matching function for call to 'cacheflush' cacheflush();)
FOC control
地平线 旭日X3 PI (一)首次开机细节
Group programming ladder race - exercise set l2-002 linked list de duplication
awk从入门到入土(4)用户自定义变量
The basic syntax of mermaid in typera
@Role of pathvariable annotation
Newh3c - routing protocol (RIP, OSPF)
Getting started with microservices: gateway gateway
Codeforces Global Round 21(A-E)
awk从入门到入土(5)简单条件匹配
L1 regularization and L2 regularization
广和通高性能4G/5G无线模组解决方案全面推动高效、低碳智能电网
学习Nuxt.js
If the array values match each other, shuffle again - PHP
转:优秀的管理者,关注的不是错误,而是优势
How does Xiaobai buy a suitable notebook
How can we make a monthly income of more than 10000? We media people with low income come and have a look
How college students choose suitable computers
Convert datetime string to datetime - C in the original time zone