Unix/Linux Go Back    

Duplicate filename algorithm

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member radoulov Regarding:
Duplicate filename algorithm.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 03-22-2010
radoulov's Unix or Linux Image
radoulov radoulov is offline
Registered User
Join Date: Jan 2007
Last Activity: 9 January 2017, 4:40 AM EST
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 630 Times in 587 Posts
as already stated, the previous Perl solutions compare the content of the files.
Could you try this Perl code and compare its performance with your shell script?

perl -MFile::Find -e'
  $d = shift || die "$0 dir\n";
  find { 
    wanted => sub {
      -f and push @{$u{$_}}, $File::Find::name;
    }, $d;
  @{$u{$_}} > 1 and printf "found %s in: \n\n%s\n\n", 
    $_, join $/, @{$u{$_}} for keys %u;    
  ' <dirname>