summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmakecolumns.sh28
1 files 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() {
32 handle_format_version_4 "${1}" 32 handle_format_version_4 "${1}"
33 elif [ -f ${1}/[Dd][Aa][Tt]/[Tt][Ee][Ii][Ll][Nn].[Dd][Aa][Tt] ]; then 33 elif [ -f ${1}/[Dd][Aa][Tt]/[Tt][Ee][Ii][Ll][Nn].[Dd][Aa][Tt] ]; then
34 handle_format_version_3 "${1}" 34 handle_format_version_3 "${1}"
35 elif [ -n "`find "${1}" -iname atb?dd00 -ls -quit`" ]; then
36 handle_format_version_2 "${1}"
35 elif [ -n "`find "${1}" -name dpr00000.005 -ls -quit`" ]; then 37 elif [ -n "`find "${1}" -name dpr00000.005 -ls -quit`" ]; then
36 handle_format_version_1 "${1}" 38 handle_format_version_1 "${1}"
37 else 39 else
@@ -84,7 +86,7 @@ get_dword() {
84} 86}
85 87
86handle_format_version_1() { 88handle_format_version_1() {
87 echo "Working on $1. Detected pre-02/1996 Telefonbuch version." 89 echo "Working on $1. Detected 1992 Telefonbuch version."
88 # Extract all dpr database files 90 # Extract all dpr database files
89 printf "Extracting dpr databases ... " 91 printf "Extracting dpr databases ... "
90 find "$1" -name dpr\*.001 | extract_version_1 92 find "$1" -name dpr\*.001 | extract_version_1
@@ -105,9 +107,31 @@ handle_format_version_1() {
105 mv 12_unknown 13_Rufnummer 107 mv 12_unknown 13_Rufnummer
106 mv 13_unknown 11_Ort 108 mv 13_unknown 11_Ort
107 mv 14_unknown 10_Postleitzahl 109 mv 14_unknown 10_Postleitzahl
108
109} 110}
110 111
112handle_format_version_2() {
113 echo "Working on $1. Detected pre 02/1996 Telefonbuch version."
114
115 # Extract all CD's pkware compressed databases
116 printf "Extracting 3 pkware databases ...\n"
117 cd=1
118 for database in `find "$1" -iname atb?dd00`; do
119 dir=`dirname ${database}`
120 base=`basename ${database}`
121 printf " %d/3 in %4s. Decompressing ... " ${cd} "$( basename ${dir} )"
122 extract_version_2 "${database}" > ${base}.dump
123
124 printf ", extracting ... "
125 indexfile=$( find ${dir} -iname atb?di00 )
126 split_version_2 "${base}.dump" "${indexfile}"
127
128 printf ", cleaning up ... "
129 rm "${base}.dump"
130 printf "done.\n"
131 cd=$((cd+1))
132 done
133
134}
111 135
112handle_format_version_3() { 136handle_format_version_3() {
113 echo "Working on $1. Detected pre-2004 Telefonbuch version." 137 echo "Working on $1. Detected pre-2004 Telefonbuch version."