Display more than two MAC addresses as an Attribute

erik_emf
New Contributor II

Hi All,

Can anyone tell me what is wrong with this script.
I am trying to get it to display more than the default two MAC addresses.

!/bin/bash

allNetworks=`networksetup listallhardwareports | awk 'BEGIN { RS=""; FS=""; } /
Port: (Wi-Fi|Thunderbolt|Ethernet|Display).*? Device: en([a-z0-9]+) Ethernet
Address: (([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}))/ { print $0; }' | awk '/(([0-9A-
Fa-f]{2}:){5}([0-9A-Fa-f]{2}))/ { print $3; }' | awk '{ print toupper($0) }'`

printf "<result>"

for line in $allNetworks
do printf "$line|"
done

printf "</result>"

1 REPLY 1

DBrowning
Valued Contributor II

i do this

#!/bin/sh

list=$(networksetup -listallhardwareports)

echo "<result>$list</result>"

for a result that looks like below3999f6ae2e224850b976317930180ac5