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

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

@letters = ("D", "F", "P", "Q", $name);
@numbers = ( 103, 122, 80,  62,   98);

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