From e7f9fc4e2a844a9e4ca51951634f2e8dabe1d2cc Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 5 Oct 2018 16:23:31 +0200 Subject: [PATCH] generate sql inserts from dla data --- dla-import-to-sql.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 dla-import-to-sql.sh diff --git a/dla-import-to-sql.sh b/dla-import-to-sql.sh new file mode 100755 index 0000000..20601e3 --- /dev/null +++ b/dla-import-to-sql.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e + + +#ls /mnt/share/DLA/inventura/*/*/upload/inv/*.pdX | while read path ; do +find /mnt/share/DLA/inventura/ . -name '*.pdX' | grep upload/inv | while read path ; do + echo "# $path" + source_id=$(echo $path | cut -d/ -f6) + date_scanned=$(echo $path | cut -d/ -f7) + strings $path | grep '130[0-9][0-9][0-9][0-9][0-9][0-9][0-9]' | sed -e 's/^.*\(130[0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*$/\1/' -e "s/^/insert ignore into ffzg_inventura (date_scanned,source_id,barcode) values ('$date_scanned','$source_id','/" -e "s/$/');/" +done -- 2.20.1