I have an array of filenames that looks something like this:
/data/node12/file-29-2.txt
/data/node12/file-34-2.txt
/data/node12/file-50-2.txt
/data/node30/file-34-2.txt
/data/node30/file-60-2.txt
/data/node30/file-62-2.txt
/data/node34/file-29-2.txt
etc. I want to remove duplicates from this array in the sense that files with the same -##- are identical, even if they are in different directories. So in the example above, I would want to eliminate /data/node30/file-34-2.txt and /data/node34/file-29-2.txt .
I can think of ways to do this, but they are probably inefficient. Since the actual array contains ~10^6 filenames, it needs to be efficient. I believe there is an easy way to do this with hashes, but I can't remember it. Thanks!