cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1069
Views
0
Helpful
7
Replies

Regex grep help

Karl Wilson
Level 1
Level 1

Hi Guys,

Im doing some work in DNAC for the security advisories and im trying to match on Regex commands. Im running the following command

show running-config | include ip http server|secure|active

But the problem is the bottom flag up from the config.

no ip http server
no ip http secure-server

 

Is there a way i can run my command above but make it exclude the no ip http server etc...

Now i dont want to run show running-config | exclude ip http server|secure|active as this then starts to present the running config apart from them lines. The aim here is for no results to appear so i know only the http element is disabled... Hope this makes sense

1 Accepted Solution

Accepted Solutions

Gotcha
This regular expression will pick up both the ip servers (and not the "no" versions) because of the starting ^ which effectivly says it must start with the characters "ip".^ip http (secure-)?server(\s)?$

 

ClaudiadeLuna_0-1685453967303.png

 

View solution in original post

7 Replies 7

Claudia de Luna
Spotlight
Spotlight

Hi @Karl Wilson 
Have you tried an exact match?

^no ip http server$
This regular expression basically says look for something that starts at the beginning of the line (^) has exactly whats in the middle and ends ($)
You may have to fiddle with a trailing space (\s)? will look for one or no single trailing space.
^no ip http server(\s)?$
Either will exclude the secure-server.

 

ClaudiadeLuna_0-1685448518449.png

 

Karl Wilson
Level 1
Level 1

Thnaks for the reply Claudia. What i want to achieve is if the http server or https sever is running or not but ignore it if the no command is in the config. If the no command is present i would like it to ignore.

If you are familiar with the dnac security advisory you can scan to match a pattern.... If it finds a pattern it will flag a a match.

I want to be able to scan all for http but ignore if the no ip http is present if you get me

Karl Wilson
Level 1
Level 1

 

KarlWilson_1-1685451897724.png

 

Gotcha
This regular expression will pick up both the ip servers (and not the "no" versions) because of the starting ^ which effectivly says it must start with the characters "ip".^ip http (secure-)?server(\s)?$

 

ClaudiadeLuna_0-1685453967303.png

 

Perfect.... Thank you for that. Much appreciated.

Hi Wilson,

Im trying the same with DNAC, it is not showing the output as expected. I would appreciate it if you post it with steps how to do it by using DNAC. 

 

Karl Wilson
Level 1
Level 1

KarlWilson_0-1698330522902.png

Thats how i done it in the end.... The reason being if you have the no ip http server it shows with running the commands above... using the ^ function i can say it must start with... So basically iv'e excluded the no command with my lines