Parsing MAC in linux with grep or awk
Posted: Wed Jan 11, 2012 11:59 am
*> ip link show eth0 | awk '/ether/ {print $2}'
00:0c:29:30:21:48
OR
*>ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
00:0c:29:30:21:48
00:0c:29:30:21:48
OR
*>ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
00:0c:29:30:21:48