text editing using bash scritping
I would like to sort the output of multipath -ll into a csv type of file using bash script. For example # multipath -ll would give the following output
360060e80056fc30000006fc30000513c dm-41 HITACHI,OPEN-V
\_ 4:0:0:45 sdcm 69:160 [active][ready]
\_ 3:0:0:45 sdcn 69:176 [active][ready]
360060e80056fc30000006fc300005162 dm-31 HITACHI,OPEN-V
\_ 3:0:0:36 sdbu 68:128 [active][ready]
\_ 4:0:0:36 sdbv 68:144 [active][ready]
360060e80056fc30000006fc300005127 dm-56 HITACHI,OPEN-V
\_ 3:0:0:6 sdg 8:96 [active][ready]
\_ 4:0:0:6 sdt 65:48 [active][ready]
What I would like is to create a csv file that would be in this format
LUN ID no., SCSI DEVICE1, SCSI DeVICE2
360060e80056fc30000006fc300005127,sdg,sdt
360060e80056fc30000006fc300005162,sdbu,sdbv
I am just looking for a basic idea of how it could be done, not the entire script. Any help would be greatly appreciated.
|