Created
February 11, 2019 10:04
-
-
Save bDrwx/3e00af66e80940d67bd16f07e8072517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('SK-KN-USKARS-SW-CE-1.txt', 'r') as myfile: | |
data = myfile.read() | |
# Hostname | |
result = re.search(r'hostname (SK-\S+)\n', data) | |
print(result.group(1)) | |
#Loopback interface | |
result = re.search(r'interface Loopback\d+\n.*ip address (\d+.\d+.\d+.\d+)', data) | |
print(result) | |
#SNMP RW and RO Access list | |
result = re.search(r'snmp-server community (.+) RO (.+)', data) | |
print(result.group(1)) | |
print(result.group(2)) | |
result = re.search(r'snmp-server host (\d+.\d+.\d+.\d+)', data) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment