View Single Post
Old 2014-10-31, 23:04   #9
Batalov's Avatar
Mar 2008

24·11·53 Posts

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: ./ 6 < aa.npg > worktodo.txt
#!/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