I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …
:date_long | 1 min Read
How to deduplicate elements using jq
####### Input file
some:
awesome:
members:
- green
- yellow
- blue
- red
- green
####### Deduplication
[arch:devopsinuse main()] yq -o=json eval /tmp/deduplicate.yaml | jq '.some.awesome.members | group_by(.) | map(select(length>1) | .[0])'
[
"green"
]
Links:
202406051406