- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
04-12-2018 01:11 AM
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!
04-14-2018 09:21 PM
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)>
04-14-2018 09:21 PM
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)>
04-16-2018 01:01 AM
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
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!