#!/usr/bin/perl for $file (@ARGV) { $out=`ldd -d -r $file 2>&1`; # Remove: libnsl.so.1 => /lib/libnsl.so.1 (0x4002c000) $out =~ s%^\s*\S+ => /\S+\s\(\S+\)$%%mg; # Remove: not a dynamic executable $out =~ s%^\s*not a dynamic executable$%%mg; # Remove: No such file or directory (dead symlinks) $out =~ s%^ldd: .*: No such file or directory$%%mg; # Remove: ldd: error: you do not have read permission for $out =~ s%^ldd: error: you do not have read permission for .*$%%mg; if($out !~ /^\s+$/s) { # Remove empty lines $out =~ s%^\s*$%%mg; $out =~ s%\n\n+%\n%g; print "$file: $out"; } }