Perl to the rescue!
perl -e '
print for sort { (($a =~ m{.*/([^0-9]*)})[0] cmp ($b =~ m{.*/([^0-9]*)})[0])
||
(($a =~ /-([0-9]+)/)[0] <=> ($b =~ /-([0-9]+)/)[0]) } <>
' -- /tmp/foo.txt
<>reads the lines of input- sort sorts the list based on the given code
m{.*/([^0-9]*)}extracts the basename up to a digit (if present)cmpdoes the string comparison- If they are equal, the
||or"or" applies the second comparison, where: /-([0-9]+)/extracts the number<=>does the numeric comparison- The
(...)[0]construct is needed as matching returns a list of matches (corresponding to$1,$2, etc). List context is needed to get the matches. We're interested in the first match only (as there's no other).