sudo id >/dev/null
+. ./shm-trunk.regex
+
# hide physical and trunk ports (> 10 mac, port nr <= 49)
cat /dev/shm/snmp-mac-port/* | cut -d' ' -f1,4 | sort | uniq -c | awk '{ if ( $1 > 10 && $3 <= 49 ) print "/"$2":"$2 " .* " $3 }' > /dev/shm/trunk.regex
--- /dev/null
+#!/bin/sh -e
+
+test -z "$1" && echo "Usage: $0 d4:ca:6d:01:4c:f2" && exit 1
+
+mac=$1
+
+. ./shm-trunk.regex
+
+grep -r -i $mac /dev/shm/snmp-mac-port/ | tee /dev/shm/mac.$mac | grep --file /dev/shm/trunk.regex -v | cut -d: -f2-
+echo "# mac $mac on "`cat /dev/shm/mac.$mac | cut -d: -f2- | cut -d' ' -f1 | sort -u | wc -l`" switches"
--- /dev/null
+# hide physical and trunk ports (> 10 mac, port nr <= 49)
+cat /dev/shm/snmp-mac-port/* | cut -d' ' -f1,4 | sort | uniq -c | awk '{ if ( $1 > 10 && $3 <= 49 ) print "/"$2":"$2 " .* " $3 }' > /dev/shm/trunk.regex