Working with regular expressions
In this recipe, we'll build on our original op script show-int.slax
, and enhance its functionality so that it can limit the output based on characteristics of the interface. In this case, it will allow the user to specify a regular expression pattern and only interfaces whose description match this pattern will be displayed.
Getting ready
In order to complete this recipe, you'll need access to a JUNOS router running with a basic configuration.
How to do it...
The following are the steps for the recipe:
- Start with the
show-int.slax
source code from the previous recipe, but this time use the new filenameshow-int-regex.slax
. - Right after the boiler-plate, declare a command-line argument that is to be user provided in order to nominate the regular expression to use:
param $description=".*"; var $arguments = { <argument> { <name> "description"; <description> "Match subset of interfaces based upon ...