Created
May 9, 2022 15:30
-
-
Save palashkulsh/2ea98a351404221f1da8c096511fda6c to your computer and use it in GitHub Desktop.
extracting from jq without creating cross product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/69973010/how-do-i-avoid-creating-a-cross-product-when-extracting-multiple-sub-elements-fr | |
cat /tmp/jira.txt | jq '.[] | {key} + (.changelog.histories[] | {created} + (.items[] | {field,fromString,toString})) | select (.field=="status")' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gojq
find all rules where length of summary is less than 350 characters
trick is to convert to flat and then do the work
gojq --yaml-input '.groups[].rules[] | {alert: .alert, summary: .annotations.summary} | select(.summary | length <350) | .alert ' cart.rules.yml