Posted on 04-12-2018 04:57 AM
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.
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>"
Posted on 04-12-2018 05:31 AM
i do this
#!/bin/sh
list=$(networksetup -listallhardwareports)
echo "<result>$list</result>"
for a result that looks like below