summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/makecolumns.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/makecolumns.sh b/src/makecolumns.sh
index 8cb255c..1d4c399 100755
--- a/src/makecolumns.sh
+++ b/src/makecolumns.sh
@@ -199,15 +199,18 @@ handle_new_format() {
199 printf "Extracting phonebook.db ... " 199 printf "Extracting phonebook.db ... "
200 decompress $1/phonebook.db | grep -v appropriate 200 decompress $1/phonebook.db | grep -v appropriate
201 201
202 numfiles=`find . -name file_\* | wc -l` 202 rows=`find . -name file_\* | wc -l`
203 rows=$(( rows / 11 ))
203 printf "done.\n" 204 printf "done.\n"
204 205
206 # Do enumerations with builtin shell tools. Unfortunally neither
207 # jot nor seq are standards
205 printf "Splitting decompressed chunks into their columns (11 total) ... 0, " 208 printf "Splitting decompressed chunks into their columns (11 total) ... 0, "
206 for file in `jot - 0 $(( numfiles - 1 )) 11`; do printf "file_%05X " ${file}; done | xargs cat | xxd -ps -c1 > column_0 209 f=0; while [ $f -lt $rows ]; do printf "file_%05X " $(( f++ * 11)); done | xargs cat | xxd -ps -c1 > column_0
207 210
208 for column in `jot 10`; do 211 for column in 1 2 3 4 5 6 7 8 9 10; do
209 printf "%d, " $column 212 printf "%d, " $column
210 for file in `jot - ${column} $numfiles 11`; do printf "file_%05X " ${file}; done | xargs cat | tr '\n\0' '\t\n' > column_${column} 213 f=0; while [ $f -lt $rows ]; do printf "file_%05X " $(( column + f++ * 11 )); done | xargs cat | tr '\n\0' '\t\n' > column_${column}
211 done 214 done
212 printf "done.\n" 215 printf "done.\n"
213 216