$ df -lkP
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/vgrs710rsrid2/lvoldata2
858283043 676273843 182009200 79% /data2
/dev/vgrs710rsrid2/lvoldata
199398672 118367215 81031457 60% /data
/dev/vgrs710jnl/lvoljnl
152256633 77300832 74955801 51% /journals
/dev/vgmsa2312t3/lvolmsadata3
1857692665 428977413 1428715252 24% /data3
/dev/vgmsa2312t4/lvolmsadata4
1717106748 439950342 1277156406 26% /data6
/dev/vgmsa2312t5/lvolmsadata5
1947765811 1871078336 76687475 97% /data5
/dev/vg00/lvol4 1041520 93368 948152 9% /home
/dev/vg00/lvol5 10482360 8147296 2335064 78% /opt
/dev/vg00/lvol6 2088120 936752 1151368 45% /tmp
/dev/vg00/lvol7 20934792 16264528 4670264 78% /usr
/dev/vg00/lvol9 9831597 19038 9812559 1% /var/opt/ignite/depots
/dev/vg00/lvol8 10422528 1068448 9354080 11% /var
/dev/vg00/lvol1 522448 279624 242824 54% /stand
/dev/vg00/lvol3 1044448 515952 528496 50% /
This can be fixed by piping the output through our old friend awk as follows;
$ df -lkP | awk '{
if ( NR == 1 ) { next }
if ( NF == 6 ) { print }
if ( NF == 5 ) { next }
if ( NF == 1 ) {
getline record;
$0 = $0 record
print $0
}
}'
This bit of awk firstly discards the first header line from df and then in the case where a line has just 1 text field the next line is appended to it and then printed, any lines with 5 fields are also discarded.
This then produces a consistent df output;
$ df -lkP | awk '{
if ( NR == 1 ) { next }
if ( NF == 6 ) { print }
if ( NF == 5 ) { next }
if ( NF == 1 ) {
getline record;
$0 = $0 record
print $0
}
}'
/dev/vgrs710rsrid2/lvoldata2 858283043 676273843 182009200 79% /data2
/dev/vgrs710rsrid2/lvoldata 199398672 118367215 81031457 60% /data
/dev/vgrs710jnl/lvoljnl 152256633 77300832 74955801 51% /journals
/dev/vgmsa2312t3/lvolmsadata3 1857692665 428977413 1428715252 24% /data3
/dev/vgmsa2312t4/lvolmsadata4 1717106748 439950342 1277156406 26% /data6
/dev/vgmsa2312t5/lvolmsadata5 1947765811 1871078336 76687475 97% /data5
/dev/vg00/lvol4 1041520 93368 948152 9% /home
/dev/vg00/lvol5 10482360 8147296 2335064 78% /opt
/dev/vg00/lvol6 2088120 936752 1151368 45% /tmp
/dev/vg00/lvol7 20934792 16264528 4670264 78% /usr
/dev/vg00/lvol9 9831597 19038 9812559 1% /var/opt/ignite/depots
/dev/vg00/lvol8 10422528 1068504 9354024 11% /var
/dev/vg00/lvol1 522448 279624 242824 54% /stand
/dev/vg00/lvol3 1044448 515952 528496 50% /
No comments:
Post a Comment