Pipe a command and using match regular expressions

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

Pipe a command and using match regular expressions

L0 Member

Dear experts!

I'm trying to compile a match which matches the following regexp: (debug|monitor).(global|level|pcap|detail\.enable) but it seems like it does not support capturing groups. I've searched for a manual for the match command but struck out. 

 

The end game here is to use it to filter show system state to capture lines containing:

  • debug.global
  • debug.level
  • debug.pcap
  • monitor.detail.enable

Looks like capture lists is supported, ie. show system state | match debug.[glp] but capturing groups is what I need.

 

Does anyone here have a solution or tip?

 

Kind regards,

Patrik

1 accepted solution

Accepted Solutions

L7 Applicator

Looks like you were already pretty close, you needed to escape the pipe. This seems to work for me:

 

 

show system state | match debug.[glp]\|monitor.detail.enable

 

 

More broadly, you could probably use although it gets a bit unwieldy after enough entries.

 

 

show system state | match debug.g\|debug.l\|debug.p\|monitor.detail.e

 

 

Good luck!

Greg

View solution in original post

4 REPLIES 4

L7 Applicator

Looks like you were already pretty close, you needed to escape the pipe. This seems to work for me:

 

 

show system state | match debug.[glp]\|monitor.detail.enable

 

 

More broadly, you could probably use although it gets a bit unwieldy after enough entries.

 

 

show system state | match debug.g\|debug.l\|debug.p\|monitor.detail.e

 

 

Good luck!

Greg

Thank you so much Greg.

They really need to improve their documentation in this part. And I need to improve my brain.

 

Can't believe I did not try that. 🙂

 

/Patrik

Thanks Greg! Huge help for us.

This is great, backwards, but great (one should escape control characters if they want to include them in the match, not the other way 'round). Thank you!

  • 1 accepted solution
  • 10885 Views
  • 4 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!