yq icon indicating copy to clipboard operation
yq copied to clipboard

Sort Keys reverse

Open christiangoudreau opened this issue 2 years ago • 0 comments

I wish I could use yq to sort keys by reverse order. There's already a sort keys that sort only in one direction.

Note:

  • how to questions should be posted in the discussion board and not raised as an issue.
  • V3 will no longer have any enhancements.

Describe the solution you'd like If we have data1.yml like: (please keep to around 10 lines )

a: a
b: b
c: c

And we run a command:

yq 'sort_keys(.) | reverse' test.yml

it could output

c: c
b: b
a: a

christiangoudreau avatar Aug 31 '22 13:08 christiangoudreau