View Single Post
Old 2014-10-31, 23:04   #9
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

2×4,591 Posts
Default

Here you will need a bit of perl (probably can be done in awk, but when you get out of one-line volume of code in awk you want to switch to perl). This takes one parameter (or 4 by default) and text on stdin, like this: ./split.pl 6 < aa.npg > worktodo.txt
Code:
#!/usr/bin/perl -w

$N = (shift || 4);

@A = <>;

for($i=1;$i<=$N;$i++) {
    print "[Worker #", $i, "]\n";
    for($k=$i;$k<@A;$k+=$N) {
        $A[$k] =~ /(\d+) (\d+)/;
        print "PRP=$1,2,$2,-1\n";
    }
}
Note: this, of course, assumes that the input if an .npg file or a .pfgw file and the first line of it is to be thrown away. Don't forget it or else you will lose the first line with a candidate (if you actually already stripped the header).

Last fiddled with by Batalov on 2014-10-31 at 23:08 Reason: (P.S.)
Batalov is offline   Reply With Quote