Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
    #7  
Old 03-22-2010
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
--
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 5,111
Thanks: 92
Thanked 422 Times in 397 Posts
Yes,
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?



Code:
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>