Awk 分别代表其三个作者姓氏的第一个字母: Alfred Aho 、Peter Weinberger、Brain Kernighan
目前在Linux中常用的是 awk 编译版本有 mawk 、gawk
以 RedHat 为代表使用的是 gawk,以Ubuntu为代表使用的是 mawk
gawk 是GUN Project 的 awk解释器的开源代码实现
CentOS 当然也用的是gawk
二、awk处理机制:
根据模式一次从文件中抽取一行文本,对这行文本进行切片(默认使用空白字符作为分隔符)
[root@server mnt]# cat test
this| is | a | file
$1 $2 $3 $4[root@server19 mnt]# awk '{print $0}' test
this is a file
[root@server19 mnt]# awk '{print $1}' test
this[root@server19 mnt]# awk '{print $2}' test
is
[root@server19 mnt]# awk '{print $3}' test
a
[root@server19 mnt]# awk '{print $4}' test
file
[root@server19 mnt]# awk '{print $1,$2}' test
this is
[root@server19 mnt]# awk '{print $1$2}' test
thisis