where the letter pairs represent hexadecimally-encoded octets. Sometimes however a script will be passed a Cisco-style address:aa:bb:cc:dd:ee:ff
or even worse, something copied and pasted from a Windows dialog box:0001.0203.0405
The one-liner below converts incoming MAC addresses in (almost) any format into the desirable form, with octets separated by colons. The MAC to be filtered is in $_.00-01-02-03-04-05
This could of course be cleaned up, using a qr// to avoid duplicating the hex-octet identifier.
s/([0-9a-f]{2})[^0-9a-f]*/$1:/ig;chop;
In reply to MAC Pretty-printer by moot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |