I have files which are named something like
foo_1.5.6-8.xyz
foo_1.5.6-9.xyz
foofoo-6.5.xyz
foofooofooo-8.7-1.xyz
foofooofooo-8.7-2.xyz
That is, the general form is name_#.#.#-#.extension, but some lack a "-#" and/or a ".#".
EDITED:
How can I delete all previous version of those files, retaining only ones with the highest versions? In the previous example, it would be:
foo_1.5.6-9.xyz
foofoo-6.5.xyz
foofooofooo-8.7-2.xyz
(I use Linux)