Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I'm trying to find files in one directory which are in another directory. The following works, but I assume there's an easier way?
for file in `ls aggtests/pips/api/v1/xml/*.t | cut -d/ -f6`; do find aggtests/pips/api/builder/ -name $file; done
Update: Rewrote to fix a tiny grep bug.
fdupes, File::Find::Duplicate (Score:1)
A homegrown version can be found here (http://www.perlmonks.org/?node_id=703798), it uses File::Find::Duplicate.
Lots of hash based solution (Score:2)
There are lots of hash based solutions that can do this, some of them are easy written in Perl...
http://en.wikipedia.org/wiki/Fdupes [wikipedia.org], also lists alternatives (including one of mine!).
-- "It's not magic, it's work..."
uniq (Score:1)
Re: (Score:2)
"ls... glob" FAIL. Please don't do that.
Re: (Score:2)
Re: (Score:1)
The other point, that filenames can contain special characters, I was aware of, but I tend to assume that 'my' files won't (unless I know that they do). If I were working on some arbitrary set of files I would have done the job in Perl (I was going to say
find -print0and{sort,uniq} -zwould work, but apparently (my)uniqdoesn't have a-zoption. Weird.). Thanks for the correction, though, since it's important to beRe: (Score:1)
That won’t do what you wanted because
echowill output the whole shebang on a single line. What you want instead isBut then that still won’t do what you wanted, because you aren’t chopping the base path off the file names, so no two lines will have the same content anyway. You need to something like this:
Of course, as mentioned, that doesn
I'd just... (Score:2)