We finally managed to build a script that fulfills our needs:
AA=()
while read aaaa
do
if [ -z "$aaaa" ];
then
continue
fi
echo "line: $aaaa"
fix=$(echo "$aaaa" | cut -d ')' -f2 | grep -viE |Wi-Fi|Thunderbolt|disabled' | sed 's/^.//')
if [ ! -z "$fix" ];
then
AA+=( "$fix" )
fi
done <<!
$(networksetup -listnetworkserviceorder)
!
for i in ${AA[@]}
do
echo $i
done
networksetup -ordernetworkservices " Office Access" " Office Access Tunnel All" Wi-Fi "Thunderbolt Ethernet" "Thunderbolt Bridge" "${AA[@]}"
Works like a Charm!
Thanks for all your help!