Hey everyone,
-edit-
I'm going to narrow my question down... so below is the code I have for reading the .txt file I have (Router Lab-A Atlanta). I need to draw specific instances of IP addresses from that router config file and print them out.
Do I need separate for loops for every search ? or can I just continue/break the loop ?
How do I code to look for specific IP addresses from the router config ? Specifically, let's say one router config file has the Ethernet ports before the Serial ports or vice versa ? The way I'm coding for the first instance of "version" would set me up for failure if the configuration files fluctuate in format.
-edit-
I'm going to narrow my question down... so below is the code I have for reading the .txt file I have (Router Lab-A Atlanta). I need to draw specific instances of IP addresses from that router config file and print them out.
Do I need separate for loops for every search ? or can I just continue/break the loop ?
How do I code to look for specific IP addresses from the router config ? Specifically, let's say one router config file has the Ethernet ports before the Serial ports or vice versa ? The way I'm coding for the first instance of "version" would set me up for failure if the configuration files fluctuate in format.
sesame = open('sample1.txt', 'r')
contents = sesame.read()
for line in open('sample1.txt'):
if "version" in line:
print (line)
break;
contents = sesame.read()
for line in open('sample1.txt'):
if "version" in line:
print (line)
break;