tolugboji via GNU coreutils General Discussion wrote: > If "sort" did support multiple delimiters, I could numerically sort the > following set of filenames > using the second field. > > schimmel-04.png > schimmel-05.png > schimmel-06.png > schimmel-07.png > schimmel-08.png > schimmel-09.png > schimmel-10.png > schimmel-11.png > schimmel-12.png > schimmel-13.png > schimmel-1.png > schimmel-2.png > schimmel-3.png
One can sort those using a numeric sort. $ sort -t- -k1,1 -k2,2n file1 schimmel-1.png schimmel-2.png schimmel-3.png schimmel-04.png schimmel-05.png schimmel-06.png schimmel-07.png schimmel-08.png schimmel-09.png schimmel-10.png schimmel-11.png schimmel-12.png schimmel-13.png Or as a non-standard extension use --version-sort. $ sort --version-sort file1 schimmel-1.png schimmel-2.png schimmel-3.png schimmel-04.png schimmel-05.png schimmel-06.png schimmel-07.png schimmel-08.png schimmel-09.png schimmel-10.png schimmel-11.png schimmel-12.png schimmel-13.png I say non-standard but it exists in GNU and FreeBSD so that may be portable enough. But it does not exist on NetBSD for example. So some caution for portability is required. Bob