summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmakecolumns.sh32
1 files changed, 30 insertions, 2 deletions
diff --git a/makecolumns.sh b/makecolumns.sh
index 288e702..c38a791 100755
--- a/makecolumns.sh
+++ b/makecolumns.sh
@@ -285,7 +285,14 @@ handle_format_version_3() {
285} 285}
286 286
287handle_format_version_4() { 287handle_format_version_4() {
288 echo "Working on $1. Detected post-2003 Telefonbuch version." 288 if [ -f $1/branchcodes.tl ]; then
289 is_yp=true
290 echo "Working on $1. Detected post-2003 Yellow Pages version."
291 else
292 unset is_yp
293 echo "Working on $1. Detected post-2003 Telefonbuch version."
294 fi
295
289 printf "Extracting street names ... " 296 printf "Extracting street names ... "
290 extract_version_4 $1/streets.tl 297 extract_version_4 $1/streets.tl
291 298
@@ -314,8 +321,10 @@ handle_format_version_4() {
314 321
315 # the 'did not object to inverse search' flag is insane and needs to be reversed 322 # the 'did not object to inverse search' flag is insane and needs to be reversed
316 if grep -q ^40 column_0; then 323 if grep -q ^40 column_0; then
324 printf "Cleanung up inverted reverse search flags ... "
317 awk '{ a=substr($0,1,1); printf "%x%x\n",index("5670123cdef89ab4",a)%16 ,substr($0,2,1) }' < column_0 > 01_Flags 325 awk '{ a=substr($0,1,1); printf "%x%x\n",index("5670123cdef89ab4",a)%16 ,substr($0,2,1) }' < column_0 > 01_Flags
318 rm column_0 326 rm column_0
327 printf "done\n"
319 else 328 else
320 mv column_0 01_Flags 329 mv column_0 01_Flags
321 fi 330 fi
@@ -355,7 +364,7 @@ handle_format_version_4() {
355 elif [ -f $1/zip-streets-geo.tl ]; then 364 elif [ -f $1/zip-streets-geo.tl ]; then
356 printf "Extracting geo coordinates (precision: street) ... " 365 printf "Extracting geo coordinates (precision: street) ... "
357 extract_version_4 $1/zip-streets-geo.tl 366 extract_version_4 $1/zip-streets-geo.tl
358 cat file_* > 91_Geokoordinaten_str 367 cat file_* > 91_Geokoordinaten_str
359 printf "done.\n" 368 printf "done.\n"
360 printf "Looking up geo coordinates for each phonebook entry ... " 369 printf "Looking up geo coordinates for each phonebook entry ... "
361 paste 10_Postleitzahl 07_Strasse | map_coords 91_Geokoordinaten_str | convert_coords > 16_Koordinaten 370 paste 10_Postleitzahl 07_Strasse | map_coords 91_Geokoordinaten_str | convert_coords > 16_Koordinaten
@@ -363,6 +372,25 @@ handle_format_version_4() {
363 fi 372 fi
364 rm file_* 373 rm file_*
365 374
375 if [ "${is_yp}" ]; then
376 printf "Extracting branch names ... "
377 extract_version_4 $1/branchcodes.tl
378 cat file_* | tr '\n\0' '\t\n' > 97_Branchenname
379 rm file_*
380 printf "done.\n"
381
382 printf "Generating branch name index ... "
383 mkdir branchcodes/
384 while read index name; do
385 printf $name > branchcodes/${index}
386 done < 97_Branchenname
387 printf "done.\n"
388
389 printf "Looking up branch names from codes ... "
390 map_branches 97_Branchenname < 09_Verweise > 09_Branchen
391 printf "done.\n"
392 rm -r branchcodes
393 fi
366} 394}
367 395
368tidy_streetnames () { 396tidy_streetnames () {