本文介绍了仅按月份名称和日期排序.重击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,尝试按月份和日期对列表进行排序.无法稳定.有指针吗?

Hello Trying to sort this list by Month and day. Can not get it staight. Any pointers ?

列表示例:

Jul 23 Drive :NTFS (Windows 31.6 GB/29.4 GiB) Details : Mounted /dev/sdc1 (Read-Write, label "FreeAgent GoFlex Drive", NTFS 3.1)
Jul 30 Drive :NTFS (Windows 31.6 GB/29.4 GiB) Details : Mounted /dev/sdb1 (Read-Write, label "HP USB FD", NTFS 3.1)
Aug 2 Drive :NTFS (Windows 31.6 GB/29.4 GiB) Details : Mounted /dev/sdb1 (Read-Write, label "WINPART", NTFS 3.1)
Jul 24 Drive :EXT (Linux) Details : EXT3-fs (sdc1)
Jul 25 Drive :EXT (Linux) Details : EXT3-fs (sdb1)
Jul 27 Drive :EXT (Linux) Details : EXT4-fs (sdb2)
Aug 2 Drive :EXT (Linux) Details : EXT3-fs (sdb1)
Aug 2 Drive :EXT (Linux) Details : EXT4-fs (sdb1)

推荐答案

如果您的 sort 版本支持它:

sort -k1,1M -k2,2n

这篇关于仅按月份名称和日期排序.重击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:01