-1

How to extract only MAC of wlan0 from ifconfig using CUT(!) in the manner of: ifconfig eth0 | grep HWaddr | cut -d ' ' -f 11 And why ifconfig wlan0 | grep HWaddr | cut -d ' ' -f 11 doesn't work in the same manner? Thanks.

  • This question is probably a better fit for [the Unix StackExchange site](http://unix.stackexchange.com). – ashes999 May 28 '15 at 20:49

1 Answers1

0
ifconfig wlan0 | grep -E -o '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'

EDIT (updated to include the cut command):

ifconfig wlan0 | grep -E -o '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | cut -f 1
J.J
  • 3,459
  • 1
  • 29
  • 35