What is the best way to extract the MAC address from ifconfig\'s output?
ifconfig
Sample output:
bash-3.00# ifconfig eth0 eth0 Link
How about this one:
ifconfig eth0 | grep -Eo ..\(\:..\){5}
or more specifically
ifconfig eth0 | grep -Eo [:0-9A-F:]{2}\(\:[:0-9A-F:]{2}\){5}
and also a simple one
ifconfig eth0 | head -n1 | tr -s ' ' | cut -d' ' -f5`