[j-nsp] Regular expressions in CLI.

Avram Dorfman avram@juniper.net
Mon, 2 Sep 2002 13:19:08 -0700


Hello David,

Yes, as others have stated, the "" will do it for you. Also, here's a 
slightly simpler regex using character classes that gives you the same:

<blah> | match "[+*]"


As for XML vs. CLI performance, most command output is rendered in XML 
internally, and transformed to CLI format afterwards. Strictly 
speaking, the XML output will be "faster" if you don't include your own 
XML processing in the equation. However, it's unlikely that the 
formatting is the limiting factor in the performance of the command 
you're having trouble with.

You can easily measure the difference like this:

 > start shell
% time "cli show route as-path-regex ^1299.* | save  /dev/null"
% time "cli show route as-path-regex ^1299.* | display xml | save 
/dev/null"

the /dev/null will remove the actual terminal display overhead from the 
equation.

while you're at it, try timing "show route | /dev/null" to see how long 
that takes. Except for transmission time of the actual result, this 
will necessarily be faster than your as-path-regex. This will help you 
see whether the regex is the time sink, or just the show route. If it 
is the as-path-regex, then perhaps leave it out, and use the match's 
regex. Just a guess, I can't really claim to know whether this will be 
any faster.

As for the bug, open a case w/ support@juniper.net; they'll determine 
if it's known, and has been fixed in a later release, or the 
in-development code.

-Avram Dorfman
Pro Services

p.s. sorry if this is a double post; having trouble with my email 
client...