I need to get several serial numbers for a bunch of vpaths.
If I do a:
lsvp -a
I get output that looks like this:
Hostname VG vpath hdisk Location LUN SN S Connection Size LSS Vol Rank
-------- -- ----- ----- -------- ------ - ---------- ---- --- --- ----
az18u039 vgu039free vpath0 hdisk6 0E-08-01 75CXKP13 N 20.0 10 57 1002
az18u039 vgu039free vpath0 hdisk42 0E-08-01 75CXKP13 N 20.0 12 50 1201
az18u039 vgu039free vpath0 hdisk251 09-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk292 09-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk322 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk353 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk376 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk428 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk7 0E-08-01 75CXKP13 N 20.0 10 58 1002
az18u039 vgu039free vpath1 hdisk43 0E-08-01 75CXKP13 N 20.0 12 56 1202
az18u039 vgu039free vpath1 hdisk253 09-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk303 09-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk323 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk354 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk377 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk429 0C-08-01 75CXKP13 N
While the vpath shows up several times (multiple paths), I only need the first occurence of each... I would like the output to look like this:
Hostname VG vpath hdisk Location LUN SN S Connection Size LSS Vol Rank
-------- -- ----- ----- -------- ------ - ---------- ---- --- --- ----
az18u039 vgu039free vpath0 hdisk6 0E-08-01 75CXKP13 N 20.0 10 57 1002
az18u039 vgu039free vpath1 hdisk7 0E-08-01 75CXKP13 N 20.0 10 58 1002
I'm thinking awk is the way to go, but my awk knowledge is lacking. Any tips/pointers would be appreciated.
Add a little color to your PUTTY terminal: faq52-6627
If I do a:
lsvp -a
I get output that looks like this:
Hostname VG vpath hdisk Location LUN SN S Connection Size LSS Vol Rank
-------- -- ----- ----- -------- ------ - ---------- ---- --- --- ----
az18u039 vgu039free vpath0 hdisk6 0E-08-01 75CXKP13 N 20.0 10 57 1002
az18u039 vgu039free vpath0 hdisk42 0E-08-01 75CXKP13 N 20.0 12 50 1201
az18u039 vgu039free vpath0 hdisk251 09-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk292 09-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk322 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk353 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk376 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath0 hdisk428 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk7 0E-08-01 75CXKP13 N 20.0 10 58 1002
az18u039 vgu039free vpath1 hdisk43 0E-08-01 75CXKP13 N 20.0 12 56 1202
az18u039 vgu039free vpath1 hdisk253 09-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk303 09-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk323 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk354 0F-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk377 0C-08-01 75CXKP13 N
az18u039 vgu039free vpath1 hdisk429 0C-08-01 75CXKP13 N
While the vpath shows up several times (multiple paths), I only need the first occurence of each... I would like the output to look like this:
Hostname VG vpath hdisk Location LUN SN S Connection Size LSS Vol Rank
-------- -- ----- ----- -------- ------ - ---------- ---- --- --- ----
az18u039 vgu039free vpath0 hdisk6 0E-08-01 75CXKP13 N 20.0 10 57 1002
az18u039 vgu039free vpath1 hdisk7 0E-08-01 75CXKP13 N 20.0 10 58 1002
I'm thinking awk is the way to go, but my awk knowledge is lacking. Any tips/pointers would be appreciated.
Add a little color to your PUTTY terminal: faq52-6627