Page 1 of 1

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

Posted: Tue Nov 12, 2024 9:15 am
by kingtrw
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!

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

Posted: Tue Nov 12, 2024 2:08 pm
by Tomas
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 :)

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

Posted: Wed Nov 13, 2024 9:42 am
by kingtrw
Thank you! Regex is deep magic, so I really apprecaite it!