I have a directory of files with filenames of the form
<num1>v<num2>.txt. I'd like to find all files for which
<num1> is a duplicate. When duplicates are found, we should delete the ones with smaller
Is this possible? I could easily write a python script to handle this, but thought it might be a nice application of built-in zsh features.
In the following list of files, the first three have duplicate
<num1> parts. As well, the fourth and fifth are duplicate.
012345v1.txt 012345v2.txt 012345v3.txt 3333v4.txt 3333v7.txt 11111v11.txt
I would like to end up with directory containing
012345v3.txt 3333v7.txt 11111v11.txt