-1

如何使用 CUT(!) 从 ifconfig 中仅提取 wlan0 的 MAC,方式如下:ifconfig eth0 | grep HWaddr | cut -d ' ' -f 11 为什么 ifconfig wlan0 | grep HWaddr | cut -d ' ' -f 11 不能以同样的方式工作?谢谢。

4

1 回答 1

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

编辑(更新为包括 cut 命令):

ifconfig wlan0 | grep -E -o '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | cut -f 1
于 2015-05-28T20:47:34.397 回答