【linux】cut

vim test
id      name    age     score
101     paul    18      100
102     suan    11      99
103     peter   18      98

[root@andon ~]# cut -f 2 test
name
paul
suan
peter

 

[root@andon ~]# cat /etc/passwd |cut -d ":"  -f 3   ##以“:”为分隔符
0
1
2
3
4

  

[root@andon ~]# df  -h |cut -f 1  ##cut缺点是不能分隔以空格键的符号,只能分隔tab键的符号,因此没有分隔
Filesystem                    Size  Used Avail Use% Mounted 
/dev/mapper/vg_andon-lv_root   50G  4.8G   43G  11% /
tmpfs                         1.9G  216K  1.9G   1% /dev/shm
/dev/sdb2                     485M   40M  420M   9% /boot
/dev/sdb1                     200M  260K  200M   1% /boot/efi
/dev/mapper/vg_andon-lv_home   63G  310M   60G   1% /home
/dev/sda1                     230G  188M  218G   1% /home/ServerStorage

  

 

相关文章:

  • 2022-02-09
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-09-03
  • 2021-07-19
  • 2021-07-21
相关资源
相似解决方案