Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting vpath info

Status
Not open for further replies.

sbrews

Technical User
Jun 11, 2003
413
US
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
 
quick way while i find my the solution in awk for you :) is this:

lsvp -a | egrep (hdisk6|hdisk7)

Regards,
Khalid
 
Not sure if this is the best solution, but after searching thru tek-tips, I found this: thread52-925981. After reviewing that, I put this together:

Code:
lsvp -a > vpath.txt
for VPATH in `lsvg -p SVC4shark12|awk '{print $1}'`
do
  cat vpath.txt | awk "( pathflag ){print $6;exit} /$VPATH/{ pathflag=1 }"
done

It shows me exactly what I want - just the first occurrence of each vpath.

Thanks to Rod Knowlton for his awk stuff that I borrowed from the afore mentioned thread.

Add a little color to your PUTTY terminal: faq52-6627
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top