Jump to the navigation menu

Reversing a YAML list

Reversing a YAML list is easy with yq:

yq eval '.testimonials |= reverse' testimonials.yml

Outputting the reversed list to a file:

yq eval '.testimonials |= reverse' testimonials.yml > testimonials2.yml