0
点赞
收藏
分享

微信扫一扫

linux shell过滤mac地址


egrep.sh

#!/bin/bash
#Description:filter MAC using egrep

ifconfig | egrep "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"

验证:

[root@logstash ~]# sh egrep.sh 
        ether 02:42:0e:ad:48:a7  txqueuelen 0  (Ethernet)
        ether 02:42:d2:90:29:4a  txqueuelen 0  (Ethernet)
        ether 00:0c:29:ed:c6:f8  txqueuelen 1000  (Ethernet)
        ether 00:0c:29:ed:c6:f8  txqueuelen 0  (Ethernet)
        ether 00:0c:29:ed:c6:f8  txqueuelen 0  (Ethernet)
        ether d2:b1:69:12:53:22  txqueuelen 0  (Ethernet)
[root@logstash ~]#

举报

相关推荐

0 条评论