#!/usr/bin/perl

# Change Bill's format to what everyone else uses

# Get today's date

@date = localtime;
$date[5] += 1900;
$date[4]++;

# Skip preliminary stuff

while(<>) {
  last if m/^AREA ID/;
}

# Print header information

print <<"EOF";
\tSquad Leader
\tThe Avalon Hill Game Company\t\t$date[5]-$date[4]-$date[3]
RK\tID\tFName\tLName\tRate\tFrq\tOpp\tRmp\tTrn\tActive
EOF

while(<>) {
  next if m/^\s*$/;
  @line = split(/\t/,$_);
  $line[0] = uc($line[0]);
  next if $line[0] !~ m/^[A-Z0-9.]+$/;
  $fname = $line[1];
  $fname =~ s/.*, *//;
  $lname = $line[1];
  $lname =~ s/ *,.*//;
  print "$line[2]\t$line[0]\t$fname\t$lname\t$line[3]\t$line[4]\t$line[5]\t$line[6]\t$line[7]\t$line[8]\n";
}
