ConfD User Community

How to sort a list with a string key in a different order?


#1

how to sort a list with a string key in a different order ?

this is my list and my key is a string

mylist elem1
mylist elem10
mylist elem11
mylist elem12
mylist elem13
mylist elem14
mylist elem15
mylist elem2
mylist elem3
mylist elem4
mylist elem5

that’s what i’m looking for

mylist elem1
mylist elem2
mylist elem3
mylist elem4
mylist elem5
mylist elem10
mylist elem11
mylist elem12
mylist elem13
mylist elem14
mylist elem15


#2

You can try the YANG annotation of tailf:sort-order snmp; which will take the length of the string into consideration during sorting. It should work for your listed requirement.