I have a list of names, which are out of order. How can I get them in the correct alphanumeric order, using a custom sort order for the alphabetical part?
My file numbers.txt
:
alpha-1
beta-3
alpha-10
beta-5
alpha-5
beta-1
gamma-7
gamma-1
delta-10
delta-2
The main point is that my script should recognize that it should print alpha
before beta
, and beta
before gamma
, and gamma
before delta
.
That is, the words should be sorted based on the order of the letters in the Greek alphabet they represent.
Expected order:
alpha-1
alpha-5
alpha-10
beta-1
beta-3
beta-5
gamma-1
gamma-7
delta-2
delta-10
PS: I tried with sort -n numbers.txt
, but it doesn't fit my need.