-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.teams.pirila.awk
46 lines (40 loc) · 1 KB
/
get.teams.pirila.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# get.team.pirila.awk
# use getXML.awk parser
# gawk -f get.data.awk pirila.xml | awk -f get.team.pirila.awk
function print_out(ClassId,TeamId,Leg,Variant) {
print ClassId,TeamId,Leg,Variant
}
BEGIN { FS="|"
OFS="|"
mem=0
}
$1 == "DAT" && $2 == "ClassId" && $3 ~ /Participants\/Participant\/ClassId$/ {
#print $2,$NF
classid=$NF
next
}
#DAT|Id|/Event/Participants/Participant/Id||1
$1 == "DAT" && $2 == "Id" && $3 ~ /Participants\/Participant\/Id$/ {
#print $2,$NF
teamid=$NF
mem=1
legid=""
variantid=""
next
}
# ATTR|Leg|/Event/Participants/Participant/Legs/Leg|LegNo|1
$1 == "ATTR" && $2 == "Leg" && $3 ~ /Participants\/Participant\/Legs\/Leg/ && $4=="LegNo" {
mem=1
legid=$5
next
}
# DAT|Course|/Event/Participants/Participant/Legs/Leg/Course||1CEH2I1
$1 == "DAT" && $2 == "Course" && $3 ~ /Participants\/Participant\/Legs\/Leg\/Course$/ && $NF != "Auto" {
#print $2,$NF
variantid=$NF
mem=1
print_out(classid,teamid,legid,variantid)
next
}
END {
}