in reply to Checking number of lines in bzipped file

Here's how I would tackle the task:

#! perl -slw use strict; use threads; use threads::shared; use Thread::Queue; use constant EXPECTED_SIZE => 244812; my( $path, $T ) = @ARGV; my $Q = new Thread::Queue; my $sem :shared; my @threads = map{ async { while( my $file = $Q->dequeue ) { my $count = `bzcat $file | wc -l`; if( $count != EXPECTED_SIZE ) { lock $sem; warn "$file: $count\n"; } } } } 1 .. $T; $Q->enqueue( glob $path ); $Q->enqueue( (undef) x $T ); $_->join for @threads; __END__ 901213 \test\*.bz2 8 2> your.log

Should run anywhere you have a threaded perl. The second command line argument is the number of concurrent processes to run.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.