awk learning notes
AWK Learning Notes
What is awk?
An awk program is a sequence of patterns and actions that tell what to look for in the input data and what to do when it’s found.
Patterns
Summary of Patterns
String-Matching Patterns
Regular Expression
转义序列
模式总结
Actions
statements in actions
注意:for (expression in array) statements
中的expression是array的index而不是array的element
built-in variables
expressions
built-in arithmetic functions
built-in string functions
expression operators
control-flow statements
用户自定义函数
function name(parameter-list) {
statements
return result
}
getline函数
注:getline < file
和getline var < file
可以用在BEGIN
中进行“预处理”(不会设置NR变量)。
Written on September 14, 2017