1.FS 输入字段分隔符,默认是空格
[root@VM-4-13-centos awk]# cat ip.txt 10.10.49.100 192.1.1.1 10.10.49.101 192.2.2.2 10.10.49.100 192.3.3.3 10.10.49.102 192.4.4.4 10.10.49.101 192.5.5.5 10.12.49.100 192.6.6.6 [root@VM-4-13-centos awk]# cat ip.txt | awk 'BEGIN{FS="."}{print $1,$2,$3}' 10 10 49 10 10 49 10 10 49 10 10 49 10 10 49 10 12 49
2.OFS 输出行分隔符,默认为换行符
[root@VM-4-13-centos awk]# cat ip.txt | awk 'BEGIN{FS=".";OFS="###"}{print $1,$2,$3}' 10###10###49 10###10###49 10###10###49 10###10###49 10###10###49 10###12###49
标签:10,FS,49,OFS,awk,10.10,### From: https://www.cnblogs.com/joyware/p/17118578.html