commit 8e802778f9c3fa967f8521191498a59a41356808
parent 83e9b6c88f3c53836a089b2bd8fc6c4a2be5e498
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Wed, 20 May 2015 23:33:10 +0200
tidy
Diffstat:
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,7 @@
+smallworld
+old/*
+routes.dat
+routesb.dat
+routesc.dat
+active.dat
+airlines.dat
diff --git a/smallworld.sh b/smallworld.sh
@@ -1,9 +1,11 @@
#!/bin/bash
cut -d ',' -f1,8 airlines.dat | tr -d '"' | tr ',' ' ' > active
-echo "\\N Y" >> active
-sort -k1,1 active | sponge active
-cut -d, -f2,3,5,7 routes.dat | grep -v 'Y$' | tr ',' ' ' | sort -k1,1 > routesb.dat
-join routesb.dat active|
+echo "\\N Y" >> active.dat
+# sponge from moreutils
+sort -k1,1 active.dat | sponge active.dat
+cut -d, -f2,3,5,7 routes.dat | grep -v 'Y$' | tr ',' ' ' |
+ sort -k1,1 > routesb.dat
+join routesb.dat active.dat |
grep -v 'N$' | cut -d ' ' -f1-3 |
awk '{if ($1 == "\\N") {
print n, $2, $3;
@@ -14,3 +16,4 @@ join routesb.dat active|
} }' > routesc.dat
g++ -Wall -o smallworld -O3 smallworld.cpp
./smallworld close < routesc.dat
+