There must be an "easy" way to do this, but I can't figure out what it is.
Assume you have a plain text "file.txt" which has lines in this format (md5 sums followed by filenames):
5ee434a2ebcf4c3c98ee07e9c1efddc0 foo.txt 365a6d8b18cab348d92db610dfc46264 bar.txt ae42d992bf622bdc425d37b04ec9c2d5 mini.txt b8e9ff5502d5dbe38b3fd5e3363caacf tyrion.txt 5ee434a2ebcf4c3c98ee07e9c1efddc0 imac.txt 542ed609dfc4d0cae44c4b7be6d66382 mba.txt 310ee92ebc69ed79c1837fc53983b7f8 mini luoma.txt 542ed609dfc4d0cae44c4b7be6d66382 tyrion final.txt
I would like to sort
file.txt and have the output:
- Only show me lines if the md5 sum indicates the files are duplicates
- Put a blank line between each "group" of duplicates.
so it would look like this:
542ed609dfc4d0cae44c4b7be6d66382 mba.txt 542ed609dfc4d0cae44c4b7be6d66382 tyrion final.txt 5ee434a2ebcf4c3c98ee07e9c1efddc0 foo.txt 5ee434a2ebcf4c3c98ee07e9c1efddc0 imac.txt
(In the real case, it could be 2 duplicates or 10, or more.)
I'm guessing there might be a
python guru out there who can figure this one out, but I'm open to pretty much any practical solution out there.