diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-11 18:37:14 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-11 18:37:14 +1200 |
commit | a6162c8d0918c80d474782ba415836bdc185e538 (patch) | |
tree | 689611f1e9d1428380f66f17eb4de7bdfb08767d /checkem | |
parent | Apply sorts to keep output stable (diff) | |
download | checkem-a6162c8d0918c80d474782ba415836bdc185e538.tar.gz (sig) checkem-a6162c8d0918c80d474782ba415836bdc185e538.zip |
Sort duplicate blocks by filesize ascendingv2.11
Diffstat (limited to 'checkem')
-rwxr-xr-x | checkem | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -25,7 +25,7 @@ use File::Find; use Digest; # Version number to make Perl::Critic happy -our $VERSION = 2.10; +our $VERSION = 2.11; # If no arguments, work with the current working directory if ( !@ARGV ) { @@ -119,8 +119,12 @@ for my $fs ( grep { @{$_} > 1 } values %sizes ) { } # Print the groups of matched files (more than one share a checksum in the -# final table); apply gratuitous sorts, just so the output remains the same for -# identical file sets -for my $dig ( sort grep { @{ $sums{$_} } > 1 } keys %sums ) { - printf "%s\n\n", join "\n", sort map { $_->{name} } @{ $sums{$dig} }; +# final table); sort the blocks by the filesize, and the files within each +# block by name +for my $group ( + sort { $a->[0]{size} <=> $b->[0]{size} } + grep { @{$_} > 1 } values %sums + ) +{ + printf "%s\n\n", join "\n", sort map { $_->{name} } @{$group}; } |