I want to parse out the MAC address from ifconfig. Since the HWaddr section is the last thing on the line, I am looking for the alphanumeric at the end of the line.
Here is what I have so far: :*([0-9a-f]{2})
I am testing in regexpal.com, and this highlights what I want, along with other things. So my next thought is to add the $
metacharacter, and this should give me the results I'm looking for.
As soon as I do this :*([0-9a-f]{2})$
, nothing matches. This is what I am matching against:
eth0 Link encap:Ethernet HWaddr aa:a9:2f:69:89:9c inet addr:10.1.8.143 Bcast:10.1.255.255 Mask:255.255.0.0 inet6 addr: fe80::89cf:56dd:fe69:899c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Cheers
[link][11 comments]