#!/usr/bin/perl

$Ps = sprintf("Parameters_pairwise.txt"); # cumulative

$lastframe=33;  # e.g. if there are 34 frames numbered 0 to 33, enter 33
# in this case Parameters should have 34 entries

$firstframe=0;  # always 0 for now

for ($counter=$firstframe; $counter<=$lastframe; $counter++) {
  $count1 = $counter+1;
  printf("count1 = $count1\n");
  $P = sprintf("P%02d.txt",$counter);
  printf("P = $P\n");
  printf("Ps = $Ps\n");

  # e.g. to get 4th entry: head -4 Parameters_pairwise.txt | tail -1

  # works fine:  head -4 Parameters_pairwise.txt | tail -1
  `head -$count1 $Ps | tail -1 > $P`

}

