Recently one of my readers asked an interesting question:
“It looks like the second pipe character (¦) in an output filter is interpreted as an OR, not as yet another filter. How can I thus implement a filter that will match string_a AND string_b?
As explained in my IP Corner article Enhance the IOS user interface, the output filters are extensions of the show command. The first ¦ character starts the filter specification and anything after the first keyword is part of a regular expression (where ¦ means or).
To match a combination of two strings, you could either write a small Tcl script or use a more convoluted regular expression where you combine both strings into a single expression (inserting .* between them to match any intermediate set of characters). For example, to find all static host routes in your router configuration, you could use the following filter:
show running | include ip route.*255\.255\.255\.255
Note: The \. matches the dot character, whereas the . matches anything.

Static default route will be missed with this regexp
ReplyDeleteWell, the filter is supposed to match static host routes (those with the mask 255.255.255.255).
ReplyDelete