0

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)

1 Answers1

0

As your codesnippet and explanation don't give much idea about the exact requirement, you may try with the below command and see if it does the thing:

rm foo*[0-9].xyz

Hope this helps !

jagatjyoti
  • 699
  • 3
  • 10
  • 29
  • Thank you for your answers. I edited my question, I apologize if it was unclear –  Aug 01 '17 at 12:51