# cat lun.txt
/dev/sdb 60002ac00000000000000f0f0000799d
/dev/sdc 60002ac00000000000000fdb0000799d
/dev/sdd 60002ac00000000000000f0f0000799d
/dev/sde 60002ac00000000000000fdb0000799d
#
How do I list all devices for a given WWID, like below:
60002ac00000000000000f0f0000799d
/dev/sdb
/dev/sdd
60002ac00000000000000fdb0000799d
/dev/sdc
/dev/sde
I have tried using sort, uniq and awk. But no luck
How about something like
device[$2]=device[$2]"\n"$1
creates an arraydevice
indexed by the wwid,$2
appends the$1
, first column with the array elementfor(i in device) print i,device[i]
prints the content of the array