[Solved] Help request - backup filter for Catalyst 9500's

Unimus support forum
Post Reply
kingtrw
Posts: 51
Joined: Sun Dec 26, 2021 8:56 pm

Tue Nov 12, 2024 9:15 am

I'm sorry to ask such a basic quesiton but I have a really hard time with regex.

We have Cisco Catalyst 9500 switches that contain a looback interface for cloud management reasons I don't fully understand:

Code: Select all

interface Loopback1000
description Meraki TLS Connection
ip address 20.0.193.162 255.255.255.255
This IP address changes dynamically, seemingly every day, so prompts a lot of change notifications.

As such, I think I need to to filter out the IP address line, but only when preceeded by the two former lines - unless there's a more sensible way?

If someone could suggest a suitable filter I'd be extremely grateful.

many thanks!
User avatar
Tomas
Posts: 1276
Joined: Sat Jun 25, 2016 12:33 pm

Tue Nov 12, 2024 2:08 pm

kingtrw wrote:
Tue Nov 12, 2024 9:15 am
...
As such, I think I need to to filter out the IP address line, but only when preceeded by the two former lines - unless there's a more sensible way?
...
Hi, something like this should work:

Code: Select all

(?m)^interface Loopback\d+\ndescription Meraki TLS Connection\nip address (.+)
Loopback can be any number in the regex above, with the description being "hard-coded". Then IP and mask are ignored.
Feel free to adjust as needed, this can also help decode what the regex does https://wiki.unimus.net/display/UNPUB/Regexp+search :)
kingtrw
Posts: 51
Joined: Sun Dec 26, 2021 8:56 pm

Wed Nov 13, 2024 9:42 am

Thank you! Regex is deep magic, so I really apprecaite it!
Post Reply