I had some files with a date in it:
some file 23.05.2017.abc
some file 23.05.2007.abc
some file 15.07.2017.abc
some file 02.12.2008.abc
To sort them, use the KEYDEF
feature of sort
:
find . | sort -k3.8d -k 3.6d -k 3.5d
It it also good to use the --debug
option of sort
, as it will show you where sort found the key.