In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "linux awk operator example introduction". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. introduction of operators
Operator describes the assignment operator = + =-= * = / =% = ^ = * * = assignment statement logical operator | | logical or & & logical and regular operator ~! Match regular expression and mismatch regular expression relational operator
< >=! = Relational operator +-add, subtract * / & multiply, divide and find remainder + -! Unary addition, subtraction and logic is not ^ * exponentiation + +-- increase or decrease, as a prefix or suffix other operator $field references the space string hyphen?: C conditional expression in array whether there is a key value
Description: awk operator is basically the same as c language. The expressions and functions are basically the same.
II. Introduction of examples
Awk assignment operator
The code is as follows:
Equivalent to: aura 5; others of the same kind
Awk logical operator
The code is as follows:
[chengmo@localhost ~] $awk 'BEGIN {a print 1 & & b5 | | b = 9) {print "print";}}'
[chengmo@localhost ~] $awk 'BEGIN {axi11transferif (a > = 9) {print "ok";}}'
Ok
Awk arithmetic operator
The code is as follows:
Note that all operands are used as arithmetic operators, operands are automatically converted to numeric values, and all non-numeric values become 0.
[chengmo@localhost ~] $awk 'BEGIN {a = "b"; print axioms
0 2
Other operators
The code is as follows:
Operator
[chengmo@localhost ~] $awk 'BEGIN {a = "b"; print asides = "b"? "ok": "err";}'
Ok
In operator
[chengmo@localhost ~] $awk 'BEGIN {a = "b"; arr [0] = "b"; arr [1] = "c"; print (an in arr);}'
0
[chengmo@localhost ~] $awk 'BEGIN {a = "b"; arr [0] = "b"; arr ["b"] = "c"; print (an in arr);}'
one
The in operator to determine whether the key exists in the array.
This is the end of the introduction to the example of linux awk operator. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.