001、 -F 指定
[root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt a:b:c 3:8:k f:6:3 [root@pc1 test01]# awk -F ":" '{print $1}' a.txt a 3 f
002、-v FS变量指定
[root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt a:b:c 3:8:k f:6:3 [root@pc1 test01]# awk -v FS=":" '{print $1}' a.txt a 3 f