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

$target = "_NSV13514";
$name = $target; 
$aper = "5";
$filter = "v";
$set = "dat" . $aper;
$solveout = "solve" . $target . "" . $aper . "_" . $filter . ".out";

@letters = ("A", "B", "C", "D", "E", $name);
@numbers = ( 62,  33,  40, 46,  45,   42);

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