fork(6) download
  1. import re
  2. data = '''1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  3. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  4. 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
  5. link/ether 00:25:b5:12:02:00 brd ff:ff:ff:ff:ff:ff '''
  6. p = re.compile(r'^\s*link/ether\s+([0-9a-fA-F]+(?::[0-9a-fA-F]+){5})\s+brd', re.M)
  7. print(p.findall(data))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
['00:25:b5:12:02:00']