/^Zyklus : / {
file = FILENAME;
next
}
/^Nummer : / {
nr = $3;
heftfile[nr] = file;
next;
}
/^Hauptpersonen : / {
person = $0;
sub(/^Hauptpersonen[ \t]*: /, "", person);
n = split(person, persons, /[ \t]*,[ \t]*/);
for (i = 1; i <= n; i++) {
person = persons[i];
if (person == "") continue;
if (!first[person] || nr < first[person]) {
first[person] = nr;
}
if (nr > last[person]) {
last[person] = nr;
}
num[person]++;
heftpers[person "@" nr] = 1;
}
inpers = 1;
next;
}
inpers && /^[ \t]/ {
person = $0;
sub(/^[ \t]*/, "", person);
n = split(person, persons, /[ \t]*,[ \t]*/);
for (i = 1; i <= n; i++) {
person = persons[i];
if (person == "") continue;
if (!first[person] || nr < first[person]) {
first[person] = nr;
}
if (nr > last[person]) {
last[person] = nr;
}
num[person]++;
heftpers[person "@" nr] = 1;
}
next;
}
/^[A-Z]/ {
inpers = 0;
next;
}
END {
print ""
print ""
print ""
print "hjp: perry rhodan: zusammenfassungen: hauptpersonen"
print ""
print ""
print " "
print " "
print "
Hauptpersonen
"
print "
"
sortcmd = "sort -o pers.sorted";
for (i in first) {
print i | sortcmd;
numaut++
}
close(sortcmd);
for (n = 0; n < numaut; n++) {
getline i < "pers.sorted";
print "- " i "
";
printf "- %d Roman%s zwischen %d und %d (%d%%)\n",
num[i], (num[i] > 1 ? "e" : ""),
first[i], last[i],
(num[i] * 100 / (last[i] - first[i] + 1)) + 0.5;
print "
"
for (j = first[i]; j <= last[i]; j++) {
if (heftpers [i "@" j]) {
printf "%d\n",
heftfile[j], j, j;
}
}
print " "
}
print "
"
print "
"
print " "
print ""
}