#!/usr/bin/perl
# break the 'solvepht' output file into pieces, one piece per star.

$target = "_iyuma";
$aper = "4";
$filter = "";
$set = "dat" . $aper;
$solveout = "solve" . $target . "_" . $aper . "_" . $filter . ".out";

#@letters = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",  "SN");
@letters = ("A", "B", "IY");
#@numbers = ( 6,   4,   1,   9,   10,  12,    99,    5);
#@numbers = ( 21,  19,  15,  24,  25,  27,     5,    20);
#@numbers = ( 23,  20,  15,  27,  28,  30,    5,    21);
@numbers = ( 11,   10,   7);
$numstar = @letters;

$index = 0;
while ($index < $numstar) {
  $let = $letters[$index];
  $num = $numbers[$index];
  printf " let $let  num $num \n";
  
  $outfile = sprintf("star%s_%s.%s", $let, $filter, $set);
  `egrep "^$num " $solveout > $outfile `;

  $index++;
}

exit 0;
