AWK包含以下几种函数:
1、算数函数
2、时间函数
3、字符串函数(*)
4、其他函数
1、算数函数
例如:sin(), cos(), rand(), sqrt(), 等
2、时间函数
mktime
3(*)、字符串函数
字符串函数常用的有以下:
split() 分割 split(string, arr, [分隔符]) 分隔符不写的话, 就默认按照FS 进行分割
length() 长度 length(dict), length(arr) , length() 参数不写的话, 就表示length($0)
gsub() 全局替换 gsub(正则表达式, 替换为的字符串, $i )
sub() 替换 同上
index() 查找 idx = index(string, str), 查找string里面是否包含str, 如果包含,idx > 0,否则 idx = 0
match() 匹配查找,比index慢, idx = match(string, 正则表达式 /exp/ ),如果string中存在 正则表达式,idx > 0, 否则 idx = 0
substr() 获得子串
tolower() 字符串转小写
toupper() 字符串转大写