summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2015-06-03 11:13:37 +0200
committerDirk Engling <erdgeist@erdgeist.org>2015-06-03 11:13:37 +0200
commit59d7c59c017b41e7894ffbe026a4404d02afcfa4 (patch)
tree9cb2abb17299321f21b33c7a8bbc76c90788b113
parent337084cd6c31450761c784a7fa723875ce2e358f (diff)
Use a jot wrapper for Linux
-rwxr-xr-xmakecolumns.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/makecolumns.sh b/makecolumns.sh
index 8df1c25..bdb04b3 100755
--- a/makecolumns.sh
+++ b/makecolumns.sh
@@ -193,7 +193,7 @@ handle_format_version_3() {
193 193
194 # Now loop over all files and dump them 194 # Now loop over all files and dump them
195 printf "Splitting decompressed nname chunks into their columns ... " 195 printf "Splitting decompressed nname chunks into their columns ... "
196 jot -w %0${filename_len}d - ${nname_file} $(( number_of_files - 1 )) 3 | split_version_3 1 1 196 JOT "%0${filename_len}d" ${nname_file} $(( number_of_files - 1 )) 3 | split_version_3 1 1
197# set -- `hexdump -n 8 -v -e '" " 1/4 "%u"' ${file}` 197# set -- `hexdump -n 8 -v -e '" " 1/4 "%u"' ${file}`
198# tail -c +$(( $2 + 1 )) ${file} 198# tail -c +$(( $2 + 1 )) ${file}
199# done | tr '\n\0' '\t\n' > 01_02_Flags_Nachname 199# done | tr '\n\0' '\t\n' > 01_02_Flags_Nachname
@@ -203,11 +203,11 @@ handle_format_version_3() {
203 printf "done.\n" 203 printf "done.\n"
204 204
205 printf "Splitting decompress vname chunks into their columns ... " 205 printf "Splitting decompress vname chunks into their columns ... "
206 jot -w "%0${filename_len}d" - ${vname_file} $(( number_of_files - 1 )) 3 | xargs cat | tr '\n\0' '\t\n' | tr -d '\377' > 03_Vorname 206 JOT "%0${filename_len}d" ${vname_file} $(( number_of_files - 1 )) 3 | xargs cat | tr '\n\0' '\t\n' | tr -d '\377' > 03_Vorname
207 printf "done.\n" 207 printf "done.\n"
208 208
209 printf "Splitting decompress table file chunks into their columns ... " 209 printf "Splitting decompress table file chunks into their columns ... "
210 jot -w %0${filename_len}d - ${table_file} $(( number_of_files - 1 )) 3 | split_version_3 4 0 210 JOT "%0${filename_len}d" ${table_file} $(( number_of_files - 1 )) 3 | split_version_3 4 0
211# for file in `jot -w %0${filename_len}d - ${table_file} $(( number_of_files - 1 )) 3`; do 211# for file in `jot -w %0${filename_len}d - ${table_file} $(( number_of_files - 1 )) 3`; do
212# # Offset into first table entry tells us how many 212# # Offset into first table entry tells us how many
213# # fields are in table file 213# # fields are in table file
@@ -300,11 +300,11 @@ handle_format_version_4() {
300 printf "done.\n" 300 printf "done.\n"
301 301
302 printf "Splitting decompressed chunks into their columns (11 total) ... 1, " 302 printf "Splitting decompressed chunks into their columns (11 total) ... 1, "
303 jot -w "file_%05X" - 0 $(( rows - 1 )) 11 | xargs cat | xxd -ps -c1 > column_0 303 JOT "file_%05X" 0 $(( rows - 1 )) 11 | xargs cat | xxd -ps -c1 > column_0
304 304
305 for col in 1 2 3 4 5 6 7 8 9 10; do 305 for col in 1 2 3 4 5 6 7 8 9 10; do
306 printf "%d, " $(( col + 1 )) 306 printf "%d, " $(( col + 1 ))
307 jot -w "file_%05X" - ${col} $(( rows - 1 )) 11 | xargs cat | tr '\n\0' '\t\n' > column_${col} 307 JOT "file_%05X" ${col} $(( rows - 1 )) 11 | xargs cat | tr '\n\0' '\t\n' > column_${col}
308 done 308 done
309 printf "done.\n" 309 printf "done.\n"
310 310
@@ -374,5 +374,17 @@ tidy_streetnames () {
374 rm "${streets}".bak 374 rm "${streets}".bak
375} 375}
376 376
377# JOT <format> <begin> <end> <step>
378JOT () {
379 case `uname -s` in
380 *BSD|Darwin)
381 jot -w "$1" - "$2" "$3" "$4"
382 ;;
383 Linux)
384 seq -f "$1" "$2" "$4" "$3"
385 ;;
386 esac
387}
388
377# After function definitions, main() can use them 389# After function definitions, main() can use them
378main "$@" 390main "$@"