diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-08 23:38:51 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-08 23:38:51 +0100 |
| commit | a9d5ab4dbf4a7c3e2caf54c96daecc8468eacf0c (patch) | |
| tree | 62c16323b026938d6627e9cbe35668207563bf7a /src | |
| parent | 7679c74a364d2cf9e3ba3a17699f7164db61a584 (diff) | |
Get rid off jot in exporter for new phonebooks. Linux only knows seq.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/makecolumns.sh | 11 |
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 | ||
