Pipe a command and using match regular expressions

Reply
Highlighted
L0 Member

Pipe a command and using match regular expressions

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


Accepted Solutions
Highlighted
L7 Applicator

Re: Pipe a command and using match regular expressions

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


All Replies
Highlighted
L7 Applicator

Re: Pipe a command and using match regular expressions

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

Highlighted
L0 Member

Re: Pipe a command and using match regular expressions

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

Highlighted
L4 Transporter

Re: Pipe a command and using match regular expressions

Thanks Greg! Huge help for us.

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 Live Community as a whole!

The Live Community thanks you for your participation!