From 19b16fb2b5af35c337209c6f59ea67a5b97c493e Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Wed, 13 May 2015 02:38:09 +0200 Subject: Automatize extracting version 2 CDs --- makecolumns.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/makecolumns.sh b/makecolumns.sh index 5d2f1aa..c3f6f95 100755 --- a/makecolumns.sh +++ b/makecolumns.sh @@ -32,6 +32,8 @@ main() { handle_format_version_4 "${1}" elif [ -f ${1}/[Dd][Aa][Tt]/[Tt][Ee][Ii][Ll][Nn].[Dd][Aa][Tt] ]; then handle_format_version_3 "${1}" + elif [ -n "`find "${1}" -iname atb?dd00 -ls -quit`" ]; then + handle_format_version_2 "${1}" elif [ -n "`find "${1}" -name dpr00000.005 -ls -quit`" ]; then handle_format_version_1 "${1}" else @@ -84,7 +86,7 @@ get_dword() { } handle_format_version_1() { - echo "Working on $1. Detected pre-02/1996 Telefonbuch version." + echo "Working on $1. Detected 1992 Telefonbuch version." # Extract all dpr database files printf "Extracting dpr databases ... " find "$1" -name dpr\*.001 | extract_version_1 @@ -105,9 +107,31 @@ handle_format_version_1() { mv 12_unknown 13_Rufnummer mv 13_unknown 11_Ort mv 14_unknown 10_Postleitzahl - } +handle_format_version_2() { + echo "Working on $1. Detected pre 02/1996 Telefonbuch version." + + # Extract all CD's pkware compressed databases + printf "Extracting 3 pkware databases ...\n" + cd=1 + for database in `find "$1" -iname atb?dd00`; do + dir=`dirname ${database}` + base=`basename ${database}` + printf " %d/3 in %4s. Decompressing ... " ${cd} "$( basename ${dir} )" + extract_version_2 "${database}" > ${base}.dump + + printf ", extracting ... " + indexfile=$( find ${dir} -iname atb?di00 ) + split_version_2 "${base}.dump" "${indexfile}" + + printf ", cleaning up ... " + rm "${base}.dump" + printf "done.\n" + cd=$((cd+1)) + done + +} handle_format_version_3() { echo "Working on $1. Detected pre-2004 Telefonbuch version." -- cgit v1.2.3