- 论坛徽章:
- 0
|
是要这样之么?
- awk '{if(!a[$1]) a[$1]=$4;else if ($2~/CPU/) {a[$1]=a[$1]","$4} else {a[$1]=a[$1]" "$2" "$3" "$4" "$5" "$6}}END{for(i in a) printf"\t%-5s%-s\n",i,a[i]}' file
复制代码
结果是这样的:
- 102 CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 Used Space C: Label: Seri Used Space D: Label: [hdd_used] Used Space Physical Memory [hdd_used]
- 201 CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 Used Space C: Label: Seri Used Space D: Label: Seri Used Space E: Label:Data [hdd_used] Used Space F: Label:Log S Used Space Physical Memory [hdd_used]
- 202 CPU0 CPU1 CPU2 CPU3 CPU4 CPU5
复制代码 |
|