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

000001

String-Matching Patterns

000002

Regular Expression

000003

000004

转义序列

000005

模式总结

000006


Actions

statements in actions

000007

注意:for (expression in array) statements 中的expression是array的index而不是array的element

built-in variables

000008

expressions

000009

built-in arithmetic functions

000010

built-in string functions

000011

expression operators

000012

control-flow statements

000013

用户自定义函数

function name(parameter-list) {
  	statements
  	return result
}

getline函数

000014

注:getline < filegetline var < file可以用在BEGIN中进行“预处理”(不会设置NR变量)。

Written on September 14, 2017