Listing the firewall rules - How to `grep` just the expression?

Hey there,

I want to use the output of listing a single Cloudflare firewall rule in another command.
The output is:

{
    "id": "123456789",
    "expression": "(ip.src in {192.168.1.1 192.168.1.2})",
    "paused": false
}

I just want to extract anything that is inside the expression field, so in this case, (ip.src in {192.168.1.1 192.168.1.2})

How can I achieve this using bash and grep, sed, awk etc.

Thank you!

I am afraid that really is a question better for StackExchange and alike than here.

You could have a look at https://stedolan.github.io/jq/ though

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.