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

$target = "_iyuma";
$name = $target; 
$aper = "3";
$filter = "clear";
$set = "dat" . $aper;
$solveout = "solve" . $target . "" . $aper . "_" . $filter . ".out";

#@letters = ("A", "B", "C", "D",   "E",    $name);
#@numbers = ( 20,  48,  26,  11,    6,    19);
@letters = ("A", "B", "C", $name, );
@numbers = ( 7,   6,   1,    4 );

$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;
