How to sort text file by date properly in sample below? The problem is that sort -k1,1 does not really work and neither can i use the dot notation such as sort -k1.6,1.9 -k1.4,1.4 -k1.1,1.2 because the form does not have a fixed length. I came up with this horror
awk '{split($1,a,".");print a[1],a[2],a[3],$2}' test.txt | sort -k3,3 -k2,2 -k1,1 | awk '{print $1 "." $2 "." $3,$4}'
while it works, i don't like the complexity. Can this be simplified, ideally with just sort?
25.3.2020 26698
24.3.2020 22600
23.3.2020 19624
22.3.2020 17377
21.3.2020 15584
20.3.2020 13704
4.3.2020 407
3.3.2020 340
2.3.2020 262
1.3.2020 211
29.2.2020 200
28.2.2020 193
27.2.2020 170
26.2.2020 135
11.2.2020 74
10.2.2020 72
9.2.2020 64
8.2.2020 62
7.2.2020 62
6.2.2020 56
5.2.2020 53
2.2.2020 43
1.2.2020 38
31.1.2020 37
30.1.2020 34
28.1.2020 28
27.1.2020 20