forked from jpatokal/openflights
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdistil_gad.awk
More file actions
37 lines (31 loc) · 797 Bytes
/
Copy pathdistil_gad.awk
File metadata and controls
37 lines (31 loc) · 797 Bytes
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
BEGIN { FS = ":" }
{
split($3,n," ")
name = ""
for(i in n) {
name = name " " substr(n[i],1,1) tolower(substr(n[i],2))
}
name = substr(name,2)
split($4,n," ")
city = ""
for(i in n) {
city = city " " substr(n[i],1,1) tolower(substr(n[i],2))
}
city = substr(city,2)
split($5,n," ")
country = ""
for(i in n) {
country = country " " substr(n[i],1,1) tolower(substr(n[i],2))
}
country = substr(country,2)
icao = $4
if(icao == "KZ") icao = $5
faa = $5
if(faa == "N") faa = ""
y = $6 + ($7/60) + ($8/3600);
if ($9 == "S") y = -y;
x = $10 + ($11/60) + ($12/3600);
if ($13 == "U") x = -x;
# ICAO, IATA, Name, City, Country, Longitude (X), Latitude (Y), Elevation (ft)
printf("%s,%s,%s,%s,%s,%s,%s,%s\n",$1,$2,name,city,country,x,y,$14);
}