On Sun, 07 Aug 2005 01:33:39 +0200, Eduard Bloch <edi@gmx.de> wrote:
Moin Tilo! Tilo Schwarz schrieb am Sonntag, den 07. August 2005:Oder: from sys import stdout from sets import Set files = ["/tmp/pc1.pkgs", "/tmp/pc2.pkgs"] sets = [Set(file(f).readlines()) for f in files] intersection = reduce(lambda x,y: x & y, sets) stdout.writelines(intersection)Viel zu lang, und langsamer als perl -ne 'print $_ if $seen{$_}; $seen{$_}=1' file1 file2
BTW, meine bevorzugte Lösung ist sowieso sort file*.txt | uniq -c | grep " 5" | cut -c9- bei 5 Files. Viele Grüße, Tilo