I think I have found a more proper way to sort it:
[example] Sort Lines (Perl).kmmacros (2.0 KB)
This looks more complicated, but what the script does is basically just this:
- It creates a list from the input, where each line is a list element (e.g. "clip.jpg").
- It converts each list element into an "array", where the first element is the complete list element itself ("clip.jpg") and the second element is only the filename part before the dot ("clip"), which is the part that is actually relevant for sorting.
- The second element is created with the regex
([^.]+)
- The second element is created with the regex
- Now the list is being sorted according to the lowercase variants of the second element of each array ("clip", "clip 03", etc.).
- After sorting the second part of each list element is stripped, as it is no longer needed.
- Finally the sorted list is converted back into individual lines again.
For a better explanation of the basic principle see this Wiki article.