I have output from luxadm display commands as below :-
DEVICE PROPERTIES for disk: /dev/rdsk/c10t60020F200000C8083F951F4C00012863d0s2
Vendor: SUN
Product ID: T300
Revision: 0201
Serial Num: Unsupported
Unformatted capacity: 242705.500 MBytes
Write Cache: Enabled
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device
Path(s):
/dev/rdsk/c10t60020F200000C8083F951F4C00012863d0s2
/devices/scsi_vhci/ssd@g60020f200000c8083f951f4c00012863:c,raw
Controller /devices/sbus@2,0/SUNW,qlc@1,30000/fp@0,0
Device Address 50020f230000c6b3,5
Host controller port WWN 210000e08b07b2bb
Class primary
State ONLINE
Controller /devices/sbus@a,0/SUNW,qlc@1,30000/fp@0,0
Device Address 50020f230000c808,5
Host controller port WWN 210000e08b07ffbb
Class secondary
State STANDBY
I have multiple c10<mpxio holder> devices i'm stepping through in a loop.
I want to pull out the Capacity and the Device Address info from above.
I then want to split up the Device Address string via the , to get a wwn and a lun/slice number
I then want to reference a variable called the wwwn so it displays a real text string.
My script is currently this. (Its in eary phases so not checking things. I just want function atm)
#!/bin/ksh
#T3 references.
#If the t3 ref will be in a $var itself
#use the following to get the more meaningful txt
#
#e.g
#echo "$(eval print \$_$var)"
_50020f230000c808="xxxxt31"
_50020f230000c6b3="xxxxt31"
_50020f230000b3d4="xxxxt32"
_50020f230000b394="xxxxt32"
print "VxvmDisk to Mpxio Place Holder\t\t\tto T3\tSlice"
#List of Vx disks
for vxdsk in $(vxdisk list | awk '/^T/ {print $1}')
do
#Get mpxio place holder
mpxtag=$(vxdisk list $vxdsk |awk '/^c10/ {print $1}')
#luxadm display /dev/rdsk/$mpxtag | awk '/capacity|Device Address/ {printf "%s ", $3}' | while read capacity devad1 devad2
luxadm display /dev/rdsk/$mpxtag | awk '/capacity|Device Address/ {print $3}' | while read capacity devad1 devad2
do
#Due to dual paths to slice we only
#only need to ref one devad
t3slice=${devad1##*,}
t3=${devad1%,*}
#DBG
echo "devad = $devad1 $devad2"
echo "Capacity = $capacity MB"
done
# Print info out per lun
print "$vxdsk = $mpxtag = $(eval print \$_$t3) slice $t3slice, Capacity $capacity"
done
The while read isn't working as the output from awk is on separate lines. I've tried a printf, but am lacking in awk knowledge to get the variables out how i need them to manipulate later.
Any ideas or is further explanation needed?