2

您好正在尝试按月和日对该列表进行排序。不能直截了当。任何指针?

列表示例:

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)
4

2 回答 2

11

如果您的版本sort支持它:

sort -k1,1M -k2,2n
于 2012-08-28T15:08:43.663 回答
0

在外国计算机上工作时,我们必须在对此类数据进行排序之前设置语言:

LC_ALL=C sort -k1,1M -k2,2n file.txt
于 2017-04-09T09:50:08.093 回答