-
Have a structure items:
Want to emit item.type only when metadata is not present. When present seems to work OK $ yq4 eval '.items[] | select(.metadata) .type' dummy.yaml But couldn't find how to invert selector. Using length looked like it should work: $ yq4 eval '.items[] | .metadata | length == 0' dummy.yaml but didn't?? $ yq4 eval '.items[] | select(.metadata | length == 0) .type' dummy.yaml |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Ah, I just found "has", and when combined with |not, seems to do OK. $ yq4 eval '.items[] | select(has("metadata") | not) .type' dummy.yaml |
Beta Was this translation helpful? Give feedback.
-
How might I use"delete" to remove items 1 and 2 from the list, leaving t3 in place? |
Beta Was this translation helpful? Give feedback.
How might I use"delete" to remove items 1 and 2 from the list, leaving t3 in place?