1.awk字段分隔符:
-F选项指定了字段分隔符为冒号
awk -F: ‘{print $1,$3}’ file
多个字段
print $1
$ awk -F":" '{ print $1 $3 }' /etc/passwd
halt7
operator11
root0
shutdown6
sync5
bin1
....etc.
$ awk -F":" ‘{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd
username: halt uid:7
username: operator uid:11
username: root uid:0
username: shutdown uid:6
username: sync uid:5
username: bin uid:1
....etc.