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

How to use DQL to extract a substring after/before/between a certain character?

In DQL, splitString and substring couldn't achieved what I want.

Before this, I can always try to be creative and use other kind of DQL function/command or manipulations and achieved what I want. But today there is just this one problem I couldn't solve, hence asking this question here.

 

In the Unix world, we can use awk, grep, sed, tail (or any combinations). It seems like it DQL there isn't this much freedom though.

Don't get me wrong, DQL is good and powerful for querying data in Grail, but when it comes to string manipulation it seems to be can be a bit lacking sometimes.

 

Anyway, the problem I'm facing is as below:

I want to extract the reason of pods not healthy as shown in the last column of screenshot below, how can I use DQL to extract the part before? (i.e to extract only the string before \\\"}]}\", \"{\\\"events ?) 

How.png

 

Best Regards,

Wai Keat

 

1 REPLY 1

You can use the parse command combined with a DPL pattern to extract the data you need into a new field.

Featured Posts