how to read mac address with sed vs python
- by getjoefree
before, i can read mac with awk tools in windows or winpe, but now it don't support winpe 4.0 64-bit. i want to get this result "set mac=A4BADB9D1E8E" with python 2.6, who could help to me. thanks a lot!
as follows:
ipconfig -all|sed -nrf getmac.sed | sed -e "s/-//g" D:\LOG\WINMAC.BAT
getmac.sed:
/Realtek/ {
n;
s/.*: ([-0-9A-F]+)/set winmac=\1/p;
}
and "ipconfig -all" command log as bellows:
ipconfig -all mac.log
Ethernet adapter Ethernet:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : WKSCN.WISTRON
Description . . . . . . . . . . . : Realtek PCIe FE Family Controller
Physical Address. . . . . . . . . : 24-B6-FD-1F-41-E7
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes