#
# Generate participants list from the 'Ucastnici.csv' sorted by
# name
#
BEGIN {
FS="|"
# create backup copy
while (getline < "ucas-e.htm" != 0) print $0 > "ucas-e.htm~"
close "ucas-e.htm"
close "ucas-e.htm~"
# copy the header
"date +'%d.%m.%Y %H:%M'" | getline timestamp
while (getline < "ucas-e_head.htm" != 0) {
sub("__date__", timestamp)
print $0
}
close "ucas-e_head.htm"
}
{
NParticip++
# generate a line of Participants list
print "" $2 " " $3 ", " $6 ", " $8 "
"
}
END {
print ""
# insert the footer
while (getline < "ucas-e_foot.htm" != 0) print $0
close "ucas-e_foot.htm"
}