Neither did your second "approach" solve the OP problems in totality. See the output
7 hostname12 Generic-legacy 10000000AB210ACF6 ---
10000000AB210ACF4 2:5:4
10000000AB210ACF4 2:3:4
10000000AB210ACF6 3:5:4
9 hostname13 Generic 10000000AB2A3006A 3:5:2
10000000AB2A30068 2:5:2
20 hostname14 Generic-legacy 10000000AB2A3000C ---
10000000AB2A3000E 3:3:1
21 HOSTNAME Generic
23 srvernam Generic-legacy 5001438002A3004A 3:3:3
5001438002A3004A ---
5001438002A30048 2:3:3
5001438002A30048 2:5:2
5001438002A30048 2:5:2