Posted on September 11, 2020 4:54 pm
 |  Asked by Ryan Rawdon
Print Friendly, PDF & Email

Hi all,


When using “show run section” or “show run | section” or any other command involving the “section” capability, it looks like there may be some unexpected behavior with regexes that contain |.


rtr-edge1.sjc#show run section ?
REGEX Regular expression for matching commands


For example if I am looking for configuration for sections route-map|prefix-list

show run section route-map|prefix-list

I only see configuration sections for route-map.  If change it to prefix-list|route-map, I see at least some of both categories.

It looks like there may be some inconsistency in how regexes are parsed when | is involved?


If I put the regex in parentheses to turn it into a group, it works as-expected – however I consider this a workaround and not a resolution.


My guess is that something about the CLI parser does not handle the presence of a pipe symbol within an arugment correctly.  While this is normal on a shell CLI, the usual fix of putting the arg in quotes is not permitted by EOS.

At the same time, if it was parsing the right hand side of the pipe as a new command (to pipe to), I would expect an error that “prefix-list” is not a recognized command.  Curious.

Posted by Tamas Plugor
Answered on September 11, 2020 4:56 pm

Hi Ryan,

You need to put the strings in paranthesis and it works fine:

See example below:


testdut(config)#show run section (route-map|prefix)
ip prefix-list testpref seq 10 permit eq 32
route-map test permit 10
set tag 10
route-map test permit 20
set tag 11
route-map test2 permit 10
set tag 40





Post your Answer

You must be logged in to post an answer.