the output of iostat is like that:
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58
sda1 0.00 0.00 0.00 0.00 0.00 0.00 25.86 0.00 6.57 5.38 0.00
sda2 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58
sdb 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 30.37 20.16 0.00
VG00-LogVol00
0.00 0.00 0.00 0.70 0.02 2.79 8.04 0.02 23.72 3.71 0.26
VG00-LogVol04
0.00 0.00 0.00 4.31 0.03 17.26 8.01 0.07 16.74 4.32 1.87
VG00-LogVol03
0.00 0.00 0.00 0.24 0.00 0.98 8.01 0.01 21.37 8.52 0.21
VG00-LogVol08
0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 14.03 2.31 0.00
VG00-LogVol01
0.00 0.00 0.00 0.00 0.00 0.00 8.03 0.00 127.25 1.17 0.00
VG00-LogVol07
0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 2.42 1.72 0.00
VG00-LogVol06
0.00 0.00 0.00 0.80 0.01 3.21 8.02 0.01 10.28 4.89 0.39
VG00-LogVol02
0.00 0.00 0.01 0.26 0.10 1.04 8.52 0.01 52.88 6.01 0.16
VG00-LogVol05
0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 3.73 0.33 0.00
I try to parse the output but when I reach "VG00-LogVol00", "VG00-LogVol04" I have problems parsing the text. Is there a way to remove the extra lines using sed?
Thank you
If VG00 is always present in split lines, you could do it like this:
sed '/VG00/ { N; s/\n// }'
With the copy/pasted text I have the following aligns the columns (GNU sed and BSD sed):
sed '/VG00/ { N; s/\n//; s/ \{5,\}/ /; }'
Output:
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58
sda1 0.00 0.00 0.00 0.00 0.00 0.00 25.86 0.00 6.57 5.38 0.00
sda2 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58
sdb 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 30.37 20.16 0.00
VG00-LogVol00 0.00 0.00 0.00 0.70 0.02 2.79 8.04 0.02 23.72 3.71 0.26
VG00-LogVol04 0.00 0.00 0.00 4.31 0.03 17.26 8.01 0.07 16.74 4.32 1.87
VG00-LogVol03 0.00 0.00 0.00 0.24 0.00 0.98 8.01 0.01 21.37 8.52 0.21
VG00-LogVol08 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 14.03 2.31 0.00
VG00-LogVol01 0.00 0.00 0.00 0.00 0.00 0.00 8.03 0.00 127.25 1.17 0.00
VG00-LogVol07 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 2.42 1.72 0.00
VG00-LogVol06 0.00 0.00 0.00 0.80 0.01 3.21 8.02 0.01 10.28 4.89 0.39
VG00-LogVol02 0.00 0.00 0.01 0.26 0.10 1.04 8.52 0.01 52.88 6.01 0.16
VG00-LogVol05 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 3.73 0.33 0.00