Sorting on the last field of a line

后端 未结 11 1028
暗喜
暗喜 2020-12-05 04:06

What is the simplest way to sort a list of lines, sorting on the last field of each line? Each line may have a variable number of fields.

Something like



        
11条回答
  •  醉话见心
    2020-12-05 04:59

    I think the only solution would be to use awk:

    1. Put the last field to the front using awk.
    2. Sort lines.
    3. Put the first field to the end again.

提交回复
热议问题