CLI output filter

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CLI output filter

L0 Member

Hello,

I would like to know if there's way how to "chain" multiple variables after pipe in some command to filter the output, something like:

<command> | match <param1>|<param2>

For example:

show running security-policy | match index|source|destination|application

 

I tried to play around with quotation marks, brackets and so on but did not get it working, only with one variable. And I consider something like that one of very basics for efficient CLI use.

Any idea how to get thsi working?

Thanks in advance!

1 accepted solution

Accepted Solutions

L7 Applicator

You can use this syntax:    show command | match param1\|param2 

 

The key is the \| between parameter1 and parameter2.  Here's "show system info" only showing the lines including "ipv6" or "wildfire" (bold added for emphasis):

 

admin@pa0-black_knight(active)> show system info | match ipv6\|wildfire

ipv6-address: unknown

ipv6-link-local-address: fe80::250:56ff:fe82:7c03/64

ipv6-default-gateway:

wildfire-version: 235397-237863

wildfire-release-date: 2018/04/14 22:09:36 MDT

 

admin@pa0-black_knight(active)>

View solution in original post

2 REPLIES 2

L7 Applicator

You can use this syntax:    show command | match param1\|param2 

 

The key is the \| between parameter1 and parameter2.  Here's "show system info" only showing the lines including "ipv6" or "wildfire" (bold added for emphasis):

 

admin@pa0-black_knight(active)> show system info | match ipv6\|wildfire

ipv6-address: unknown

ipv6-link-local-address: fe80::250:56ff:fe82:7c03/64

ipv6-default-gateway:

wildfire-version: 235397-237863

wildfire-release-date: 2018/04/14 22:09:36 MDT

 

admin@pa0-black_knight(active)>

Hi,

This is great info, thank you!

By the way, is there also a way to mix 'match' and 'except' parameters? For example like:

show system info | match ipv6\|wildfire | except version

  • 1 accepted solution
  • 7331 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!