提取df命令结果

2013-11-28 lqy awk

[root@localhost ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      19102160    733112  17398708   5% /
tmpfs                   255568         0    255568   0% /dev/shm
/dev/sda1               495844     29851    440393   7% /boot
/dev/sr0               3727170   3727170         0 100% /media
[root@localhost ~]# df | awk 'NR==1{n=index($0,"Use%")}{print substr($0,n)}'
Use% Mounted on

  5% /
  0% /dev/shm
  7% /boot
100% /media
[root@localhost ~]#

发表评论:

Powered by emlog