开始正文之前,推荐下这里有个介绍awk数组的精华帖:
grep XXYY..log | tr -d '][' | awk 'BEGIN{ FS="|" }{ [match]2; print $4...,a[0],b[0] }'
match(s, r [, a])
the in s where the r occurs, or 0 if r is not , and sets the...The 0'th of a the of s by the entire r....普通用法
match(字符串,正则表达式)
内置变量RSTART表示匹配开始的位置awk 函数,表示匹配的长度
如果匹配到了,返回匹配到的开始位置,否则返回0
$ awk 'BEGIN{...+(bar*)/, arr) #匹配到的部分自动赋值到arr中awk 函数,下标从1开始
print arr[1], arr[2]
print arr[1, "start"], arr[1, "