Linux

根據行中的最後一個數字對數字進行排序

  • May 17, 2022

以下是文件範例

585.3 M   netG ple jdhe jdhe_daily se 1732 pcv DC month 202204 day 20220413
585.5 M   netG ple jdhe jdhe_daily se 1734 pcv DC month 202204 day 20220413
585.8 M   netG ple jdhe jdhe_daily se 1733 pcv DC month 202204 day 20220413
585.9 M   netG ple jdhe jdhe_daily se 1731 pcv DC month 202203 day 20220304
586.1 M   netG ple jdhe jdhe_daily se 1732 pcv DC month 202203 day 20220304
586.5 M   netG ple jdhe jdhe_daily se 1735 pcv DC month 202204 day 20220413
587.1 M   netG ple jdhe jdhe_daily se 1734 pcv DC month 202203 day 20220304
587.3 M   netG ple jdhe jdhe_daily se 1733 pcv DC month 202203 day 20220304
587.4 M   netG ple jdhe jdhe_daily se 1736 pcv DC month 202204 day 20220413
587.4 M   netG ple jdhe jdhe_daily se 1737 pcv DC month 202204 day 20220413
587.7 M   netG ple jdhe jdhe_daily se 1738 pcv DC month 202204 day 20220413
588.0 M   netG ple jdhe jdhe_daily se 1735 pcv DC month 202203 day 20220304
594.3 M   netG ple jdhe jdhe_daily se 1730 pcv DC month 202205 day 20220515
594.3 M   netG ple jdhe jdhe_daily se 1737 pcv DC month 202203 day 20220303

我們想將最後一個欄位上的日期從舊日期排序到新日期

劑量sort命令支持根據最後一個欄位對數字進行排序嗎?

sort -k 14b,14 file

按第 14 列排序

引用自:https://unix.stackexchange.com/questions/702877