cut作用及用法:

  cut [-option] 文件名

    cut - remove sections from each line of files

         从一个文件每一行里剪切某段内容

      -d:指定字段分隔符,默认分隔符为空格

      -f:指定要显示的字段

        -f1,3 显示1和3段  

        -f1-3 显示从1到3段,即1,2,3段

[root@xuelinux test]# cut -d : -f1,3 /etc/passwd

root:0

bin:1

daemon:2

adm:3

lp:4

sync:5

shutdown:6

[root@xuelinux test]# cut -d : -f1-3 /etc/passwd

root:x:0

bin:x:1

daemon:x:2

adm:x:3

lp:x:4

sync:x:5

shutdown:x:6