#!/usr/bin/perl
#

$debug = 1;


foreach $range ("near", "middle", "distant") {

  $infile = sprintf "../snlist_%s.dat", $range;
  open(INFILE, "$infile") || die("can't open file $infile");
  while (<INFILE>) {
    $line = " " . $_;
    chomp($line);

    @words = split(/\s+/, $line);
    $name = $words[1];
    $year = $name;
    $year =~ s/[a-z]//g;
    $year =~ s/[A-Z]//g;
    if (($year > 20) && ($year < 100)) {
      $year += 1900;
    }

    # now get the redshift
    $z = substr($line, 92, 6);
    $z =~ s/\?//g;
    if ($z <= 0.0) {
      next;
    }

    printf " %6d  %9.4f  \n", $year, $z;
  }
  close(INFILE);


}

exit 0;
