From 029de7b13d490bc41bd546d3218d37bd4ca1c445 Mon Sep 17 00:00:00 2001 From: User Erdgeist Date: Mon, 3 Feb 2014 06:53:47 +0000 Subject: Remove unnecessary output, be verbose about what is currently done --- src/makecolumns.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/makecolumns.sh b/src/makecolumns.sh index 1d19ada..5ee4f4a 100644 --- a/src/makecolumns.sh +++ b/src/makecolumns.sh @@ -162,17 +162,23 @@ handle_old_format() { } handle_new_format() { + echo "Working on $1. Detected post-2003 Telefonbuch version." + printf "Extracting street names ... " ../bin/decompress $1/streets.tl - cat file_* > streets + cat file_* | tr '\n\0' '\t\n' > 99_Strassenname rm file_* + printf "done.\n" - ../bin/decompress $1/phonebook.db + printf "Extracting phonebook.db ... " + ../bin/decompress $1/phonebook.db | grep -v appropriate numfiles=`find . -name file_\* | wc -l` + printf "done.\nFound %d entries.\n" $numfiles + printf "Splitting decompressed chunks into their columns ... " for column in `jot - 0 10 1`; do - for file in `jot - ${column} ${numfiles} 11`; do + for file in `jot - ${column} $(( numfiles - 1 )) 11`; do acton=`printf file_%05X ${file}` if [ ${column} = 0 ]; then xxd -ps -c1 ${acton} >> column_0; @@ -181,7 +187,11 @@ handle_new_format() { fi done; done + printf "done.\n" + + printf "Cleaning up decompressed chunks ... " find . -name file_\* -delete + printf "done.\n" mv column_0 01_Flags mv column_1 02_Nachname @@ -195,23 +205,30 @@ handle_new_format() { mv column_9 13_Rufnummer mv column_10 14_15_Email_Webadresse - [ -e streets ] && tr '\n\0' '\t\n' < streets > 99_Strassenname && rm streets + printf "Looing up street names from indexes ... " + cut -f 1 07_08_Strassenindex_Hausnummer | ${EL} -0 99_Strassenname > 07_Strasse + printf "done.\n" - if [ -e 99_Strassenname ]; then - cut -f 1 07_08_Strassenindex_Hausnummer | ${EL} -0 99_Strassenname > 07_Strasse - else - echo Could not convert streetindexes - fi + printf "Splitting house numbers ... " sed -E $'s:$:\t:' < 07_08_Strassenindex_Hausnummer | cut -f 2 > 08_Hausnummer + printf "done.\n" if [ -f $1/zip-streets-hn-geo.tl ]; then + printf "Extracting geo coordinates (precision: house number) ... " ../bin/decompress $1/zip-streets-hn-geo.tl cat file_* > 90_Geokoordinaten_hnr + printf "done.\n" + printf "Looking up geo coordinates for each phonebook entry ... " lam 10_Postleitzahl -s $'\t' 07_Strasse -s $'\t' 08_Hausnummer | ../bin/mapcoords 90_Geokoordinaten_hnr > 16_Koordinaten + printf "done.\n" elif [ -f $1/zip-streets-geo.tl ]; then + printf "Extracting geo coordinates (precision: street) ... " ../bin/decompress $1/zip-streets-geo.tl cat file_* > 91_Geokoordinaten_str + printf "done.\n" + printf "Looking up geo coordinates for each phonebook entry ... " lam 10_Postleitzahl -s $'\t' 07_Strasse | ../bin/mapcoords 91_Geokoordinaten_str > 16_Koordinaten + printf "done.\n" fi rm file_* } -- cgit v1.2.3