How can I sort file names by version numbers?

前端 未结 7 1205
轮回少年
轮回少年 2020-12-05 13:23

In the directory \"data\" are these files:

command-1.9a-setup
command-2.0a-setup
command-2.0c-setup
command-2.0-setup

7条回答
  •  再見小時候
    2020-12-05 13:53

    If you specify to sort that you only want to consider the second field (-k2) don't complain that it does not consider the third one.

    In your case, run sort --version-sort without any other argument, maybe this will suit better.

提交回复
热议问题