0
configuration="""
interface value is 3/40
    description eth/1-20-ugb-eth/58
    logging event port 
    ip address 34.5.62
    no downtine
interface value is 1/67
    description eth/4-56-ugb-eth/78
    logging event address
    ip address 5.7.8.9
    no downtime"""

expected output:

interface value is 3/40
  description eth/1-20-ugb-eth/58
  logging event port 
  ip address 34.5.62
  no downtine

here I need to print interface configuration based on my value. if value is 3/40 then need to print particular configuration of the interface but am getting the all interface lines.Can any one please assist me regarding this.

my code:

re.search(
    r"\b{0}(.*)\b".format("interface value{}".format("3/40")) + r"downtime",
    configuration,
    re.DOTALL,
)
hurlenko
  • 1,363
  • 2
  • 12
  • 17
navya sri
  • 428
  • 5
  • 18

0 Answers0