Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 543

jq manipulate object where field matches regex

$
0
0

I need to delete a field .xxx from an object at any depth of the tree where another field .myfield matches a regex.

I know how to match a precise content:

walk(if type == "object" and .myfield == "my content" then del(.xxx) else . end)'

I know about the regex filter

select(.myfield | test(my regexp))

How can I convert that filter to a boolean condition for use in the if clause?


Viewing all articles
Browse latest Browse all 543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>