我有一堆文件,想根据文件名中表示的日期对它们进行排序,如“2013-03-29_13-56-30”。我正在使用bash
.
myapplication-1.0-SNAPSHOT-V2013-03-29_13-56-30.jar
myapplication-1.0-SNAPSHOT-V2013-12-03_17-01-51.jar
myapplication-1.0-SNAPSHOT-V2013-04-04_13-49-58.jar
myapplication-1.0-SNAPSHOT-V2013-04-04_14-25-51.jar
myapplication-1.0-SNAPSHOT-V2013-04-05_10-06-33.jar
myapplication-1.0-SNAPSHOT-V2013-04-05_13-49-49.jar
myapplication-1.0-SNAPSHOT-V2013-08-09_17-48-54.jar
myapplication-1.0-SNAPSHOT-V2013-11-10_09-46-33.jar
谢谢
我不确定,但sort -n
似乎足够了,因为我所有文件中的前缀都相同。这个对吗?