-
Hi! I'm trying to sort a file so that keys are sorted, key value pairs are sorted by their I'm able to recursively sort using Additionally I want to make Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sure: yq 'with(.. | select(tag == "!!seq" and length > 0 and (.[0] | has("name")));
. |= (sort_by(.name) |
(.[] |= pick(["name"] + keys | unique)) )
)' file.yaml Explanation:
Hope that helps! |
Beta Was this translation helpful? Give feedback.
Sure:
Explanation:
.. | select(tag == "!!seq" and length > 0 and (.[0] | has("name")))
pick
to all the childrenHope that helps!