I am working with router configurations and need to write a Python script to loop through a config file, search a specific string for a specific item, in this case an IP address, store it as a variable, and then use that variable in another string. For example:
interface Vlan88
ip address 12.37.221.1 255.255.255.0
!
!
standby 1 ip (insert ONLY 12.37.221.1 here)
And do this same thing for any and all other interfaces
I'll be honest....at present tries == 0 because this is beyond my knowledge level. However, I am using regex to replace some helper addresses as well as write the HSRP config portion. But, I am not far enough along to know how to search for something specific and turn it into a variable.