#! /bin/bash

#*
# Transform student's names to upper-case ASCII letters, without
# diacritics and spaces, and use these strings as matching keys.

# USAGE:
#   $0 names.lst
#   $0 < names.lst
#**

set -ue
#set -x

cat ${1+"$@"} \
| perl -CS \
     -MUnicode::Normalize \
     -ne 'chomp;
          $d = $_;
          s/^.*\///; 
          s/\s/_/g; 
          s/-/_/g;
          s/__*/_/g;
          $_ = NFD($_);
          s/[^\0-\x80]//g;
          print uc, "\t", $d, "\n"' \
