bigworld.sh (1156B)
1 #!/bin/bash 2 3 if [ ! -f airlines.dat ] 4 then 5 wget -O airlines.dat 'https://raw.githubusercontent.com/jpatokal/openflights/master/data/airlines.dat' 6 fi 7 8 if [ ! -f routes.dat ] 9 then 10 wget -O routes.dat 'https://raw.githubusercontent.com/jpatokal/openflights/master/data/routes.dat' 11 fi 12 13 cut -d ',' -f1,8 airlines.dat | tr -d '"' | tr ',' ' ' > active.dat 14 echo "\\N Y" >> active.dat 15 # sponge from moreutils 16 sort -k1,1 active.dat | sponge active.dat 17 18 cut -d, -f2,3,5,7 routes.dat | grep -v 'Y$' | tr ',' ' ' | 19 sort -k1,1 | join - active.dat | 20 grep -v 'N$' | cut -d ' ' -f1-3 > routes_active.dat 21 22 sort -k1,1 routes_active.dat | 23 ./number.sh > routes_naive.dat 24 cat routes_active.dat <(sed 's/#.*//' routes_add) | 25 sed "`cat changes | sed 's/\(...\) \(...\)/s_\1_\2_g;/'`" | 26 grep -vE `cat forbidden | grep -v '#' | tr '\n' '|' | sed 's/|$//'` | 27 sort -k1,1 | 28 ./number.sh > routes_fix.dat 29 30 g++ -Wall -o bigworld -O3 bigworld.cpp 31 ./bigworld < routes_naive.dat | tee pairs_naive.out 32 #./bigworld close < routes_fix.dat | tee pairs_close.out 33 ./bigworld < routes_fix.dat | tee pairs.out 34 35 for a in euclidean haversine 36 do 37 sort -k3,3n < $a | sponge $a 38 done 39