I have output from a router (but I believe modem output may be similar) with mac addresses in the format:
0050.56AC.4022
Four digit blocks separated by dots but I needed it in the format of 2 digit blocks separated by colons. My router output was lines like this:
INTERNET 123.111.123.111 8 0050.56AC.1765 ARPA VLAN.1.16
And I wanted:
INTERNET 123.111.123.111 8 00:50:56:AC:17:65 ARPA VLAN.1.16
And I achieved it with the following:
cat getArpIpFromRouter.sh | grep “….\…..\…..” | tr “[:lower:]” “[:upper:]” | sed ‘s/^\(.*\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\.\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\.\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\(.*\)$/\1 \2:\3:\4:\5:\6:\7 \8/’