[Contents] [Prev] [Next] [Index] [Report an Error]

Filtering Command Output

For operational commands that display output, such as the show commands, you can redirect the output into a filter or a file. When you display help about these commands, one of the options listed is |, called a pipe, which allows you to filter the command output.

For example, if you enter the show configuration command, the complete Services Router configuration is displayed on the screen. To limit the display to only those lines of the configuration that contain address, issue the show configuration command using a pipe into the match filter:


user@host> show configuration | match address




                
address-range low 192.168.3.2 high 192.168.3.254;
address-range low 192.168.71.71 high 192.168.71.254; 
address 192.168.71.70/21;
address 192.168.2.1/24;
address 127.0.0.1/32;

For a complete list of the filters, type a command, followed by the pipe, followed by a question mark (?):


user@host> show configuration | ?
Possible completions:
  compare              Compare configuration changes with prior version
  count                Count occurrences
  display              Show additional kinds of information
  except               Show only text that does not match a pattern
  find                 Search for first occurrence of pattern
  hold                 Hold text without exiting the --More-- prompt
  last                 Display end of output only
  match                Show only text that matches a pattern
  no-more              Don't paginate output
  request              Make system-level requests
  resolve              Resolve IP addresses
  save                 Save output text to file
  trim                 Trim specified number of columns from start of line

You can specify complex expressions as an option for the match and except filters. For more information about command output filtering and creating match expressions, see the JUNOS System Basics Configuration Guide.

To filter the output of configuration mode commands, use the filter commands provided for the operational mode commands. In configuration mode, an additional filter is supported. See the J-series Services Router Configuration Guide.


[Contents] [Prev] [Next] [Index] [Report an Error]