#!/usr/bin/perl -w # read sorted md5sum/shasum output, kill duplicate files. use strict; my $ohash = ''; my $opath = ''; my $nhash; my $npath; while (<>) { chomp; if (/^(\S+)\s*(.*)/) { $nhash = $1; $npath = $2; } else { warn "$_: not a good line"; } if ($ohash eq $nhash) { unlink("$opath") || warn "$opath: $!\n"; print "removing $opath\n"; } $ohash = $nhash; $opath = $npath; } exit(0);