netbox-agent/netbox_agent/drivers/file.py

10 lines
191 B
Python
Raw Permalink Normal View History

2019-08-05 11:54:06 +02:00
import re
def get(value, regex):
for line in open(value, 'r'):
r = re.search(regex, line)
if r and len(r.groups()) > 0:
return r.groups()[0]
return None