in reply to Running a Perl Code within a Perl Code Using "Shell Module"
find -name '*.fasta' -maxdepth 1 -print0 \ | xargs -r -0 -P5 -n1 sh -c 'perl mycode.pl "$1" > ~/MyPerl/result_ans +/"$1".out' ''
Whenever you find yourself thinking “I want to start a bunch of processes like this one with different parameters,” xargs probably has your back. When it involves files, find -print0 | xargs -0 is the standard tool.
Or else you put parallelism into your main script itself – the feasibility of that varies. (In your case it would have to be adapted to create output logfiles per some sort of filename template.)
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Running a Perl Code within a Perl Code Using "Shell Module"
by monkfan (Curate) on Nov 10, 2005 at 04:01 UTC | |
by Aristotle (Chancellor) on Nov 10, 2005 at 04:06 UTC |