From a9d5ab4dbf4a7c3e2caf54c96daecc8468eacf0c Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 8 Feb 2014 23:38:51 +0100 Subject: Get rid off jot in exporter for new phonebooks. Linux only knows seq. --- src/makecolumns.sh | 11 +++++++---- 1 file 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() { printf "Extracting phonebook.db ... " decompress $1/phonebook.db | grep -v appropriate - numfiles=`find . -name file_\* | wc -l` + rows=`find . -name file_\* | wc -l` + rows=$(( rows / 11 )) printf "done.\n" + # Do enumerations with builtin shell tools. Unfortunally neither + # jot nor seq are standards printf "Splitting decompressed chunks into their columns (11 total) ... 0, " - for file in `jot - 0 $(( numfiles - 1 )) 11`; do printf "file_%05X " ${file}; done | xargs cat | xxd -ps -c1 > column_0 + f=0; while [ $f -lt $rows ]; do printf "file_%05X " $(( f++ * 11)); done | xargs cat | xxd -ps -c1 > column_0 - for column in `jot 10`; do + for column in 1 2 3 4 5 6 7 8 9 10; do printf "%d, " $column - for file in `jot - ${column} $numfiles 11`; do printf "file_%05X " ${file}; done | xargs cat | tr '\n\0' '\t\n' > column_${column} + f=0; while [ $f -lt $rows ]; do printf "file_%05X " $(( column + f++ * 11 )); done | xargs cat | tr '\n\0' '\t\n' > column_${column} done printf "done.\n" -- cgit v1.2.3