laradb

script pour établir une bdd Ãà partir d'un tsv avec différent format - retour accueil

git clone git://bebou.netlib.re/laradb
Log | Files | Refs |

commit 63c8de695fcba5812f9c3d980e8f15cfd52b5015
parent cde4972de2e5116176359039980ddb1a3679a627
Auteurice: vi Coloc <vi@coloc.re>
Date:   Sun,  3 Nov 2024 16:01:38 +0100

je crois tmp est pas push et mm vide il est désormais nécessaire

Diffstat:
Atmp/brouillon_debiandate | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atmp/dateEpoch_final.tsv | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Atmp/date_epoch_debian.sh | 47+++++++++++++++++++++++++++++++++++++++++++++++
Atmp/end | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Atmp/end_unixepoch | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Atmp/start | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Atmp/start_unixepoch | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 369 insertions(+), 0 deletions(-)

diff --git a/tmp/brouillon_debiandate b/tmp/brouillon_debiandate @@ -0,0 +1,62 @@ +cut -f1 tmp/start | +xargs - + + +date +%s --date="19700101" + + +cut -f1 tmp/start | xargs -d'\n' -n1 zsh -c 'printf "date +%%s --date=\" %b \" \n" ' -- + +sh -c ' date +%s --date=" 19710501 " +date +%s --date=" 19730101 " +date +%s --date=" 19730401 " +date +%s --date=" 19731101 " +date +%s --date=" 19740101 " +date +%s --date=" 19740301 " +date +%s --date=" 19741123 " +date +%s --date=" 19000101 " +date +%s --date=" 19750101 " +date +%s --date=" 19750101 " +date +%s --date=" 19750101 " +date +%s --date=" 19750101 " +date +%s --date=" 19751101 " +date +%s --date=" 19760101 " +date +%s --date=" 19760601 " +date +%s --date=" 19761001 " +date +%s --date=" 19770101 " +date +%s --date=" 19770101 " +date +%s --date=" 19770308 " +date +%s --date=" 19770501 " +date +%s --date=" 19770601 " +date +%s --date=" 19771001 " +date +%s --date=" 19771101 " +date +%s --date=" 19000101 " +date +%s --date=" 19770101 " +date +%s --date=" 19780101 " +date +%s --date=" 19780101 " +date +%s --date=" 19780101 " +date +%s --date=" 19780101 " +date +%s --date=" 19780101 " +date +%s --date=" 19780201 " +date +%s --date=" 19780301 " +date +%s --date=" 19780401 " +date +%s --date=" 19780401 " +date +%s --date=" 19780701 " +date +%s --date=" 19780901 " +date +%s --date=" 19781101 " +date +%s --date=" 19790101 " +date +%s --date=" 19790101 " +date +%s --date=" 19790101 " +date +%s --date=" 19790201 " +date +%s --date=" 19790301 " +date +%s --date=" 19790401 " +date +%s --date=" 19790401 " +date +%s --date=" 19790501 " +date +%s --date=" 19790601 " +date +%s --date=" 19790601 " +date +%s --date=" 19790601 " +date +%s --date=" 19790701 " +date +%s --date=" 19791107 " +date +%s --date=" 19791201 " +date +%s --date=" 19790101 " +' diff --git a/tmp/dateEpoch_final.tsv b/tmp/dateEpoch_final.tsv @@ -0,0 +1,52 @@ +41900400 94690800 +94690800 157762800 +102466800 1304200800 +120956400 749430000 +126226800 -2208989361 +131324400 218242800 +154393200 204501600 +126226800 176079600 +157762800 157762800 +157762800 157762800 +157762800 220921200 +157762800 168130800 +184028400 184028400 +189298800 378687600 +202428000 231285600 +212972400 273448800 +220921200 283993200 +220921200 378687600 +226623600 323391600 +231285600 433810800 +233964000 283993200 +244508400 325980000 +247186800 883609200 +249778800 283993200 +220921200 444438000 +252457200 441759600 +252457200 315529200 +252457200 347151600 +252457200 -2208989361 +252457200 281314800 +255135600 -2208989361 +257554800 404953200 +260233200 260233200 +260233200 328658400 +268092000 -2208989361 +273448800 -2208989361 +278722800 694220400 +283993200 915145200 +283993200 -2208989361 +283993200 -2208989361 +286671600 -2208989361 +289090800 -2208989361 +291769200 347151600 +291769200 323391600 +294357600 378687600 +297036000 494373600 +297036000 315529200 +297036000 -2208989361 +299628000 441759600 +310777200 395618400 +312850800 599612400 +283993200 -2208989361 diff --git a/tmp/date_epoch_debian.sh b/tmp/date_epoch_debian.sh @@ -0,0 +1,47 @@ +#! /bin/sh +# what this script does : +# - cleaning the date date so it is under the unix epoch format so that +# - it can be used as a value for bc in src/frise.sh +# @TODO: apply to both field, and use tsv utils rather than cut to use field header names instead of -f4,5 if +# if one day the start_date and end_date aren't anymore the 4th and 5th field of the tsv (however header names must stay persistent +# NaN values are defaulted to 1900 01 01 00:00 + + +#start= `mktemp tmp/start.XXXXXXX` +#end= `mktemp tmp/end.XXXXXXX ` +# | xargs date -j +%s # to transform every value into seconds since epoch to bc for the frise + +clean(){ +cut -f$1 -d" " src/db.tsv | +sed '1d; +s/-//g; # date 19701210 +s/^\([0-9]*\)\(.*$\)/\1 #\2/g; # prepare for cleaning with comment +s/^\(.{2}\).*/\1/; # finale clean 1970 #comment +s/^\([0-9]*\)/\100000000/; #adding the zero we need for the date xargs command to work +# second part data cleaning for xargs date +s/[0-9]/X/13; #preparation to delete the non-needed zero +s/X.[^#]*/ /g; #delete the zero +s/^\([12]...\)0000/\10101/; # 197001010000 @TODO for date after 2000** +s/^\([12].....\)00/\101/; # 197009010000 +s/#/ #/; # make the comments a new field #| once there was a pipe +s/^0\{8\}/190001010000/; # for NaN gives a date +# for debian date add : +s/0000 / /; # in format YYYYMMDD ' +#cut -f1 | +#xargs -n1 date -j +%s +} +clean 4 > tmp/start +clean 5 > tmp/end +paste -d "\t" tmp/start tmp/end | tee tmp/dateEpoch_final.tsv + +cut -f1 tmp/start | +xargs -I XX -d'\n' -n1 date +%s --date="XX" | +tee tmp/start_unixepoch + +cut -f1 tmp/end | +xargs -I XX -d'\n' -n1 date +%s --date="XX" | +tee tmp/end_unixepoch + +paste -d "\t" tmp/start_unixepoch tmp/end_unixepoch | tee tmp/dateEpoch_final.tsv + + diff --git a/tmp/end b/tmp/end @@ -0,0 +1,52 @@ +19730101 # +19750101 # +20110501 # +19931001 # +19000101 # +19761201 # +19760625 # +19750801 # +19750101 # +19750101 # +19770101 # +19750501 # +19751101 # +19820101 # +19770501 #? +19780901 # +19790101 #? +19820101 #? +19800401 # +19831001 # +19790101 # +19800501 # +19980101 #? +19790101 # +19840201 # +19840101 # +19800101 # +19810101 # +19000101 # +19781201 # +19000101 # +19821101 # +19780401 # +19800601 # +19000101 # +19000101 # +19920101 #? +19990101 # +19000101 # +19000101 # +19000101 #? +19000101 #? +19810101 # +19800401 # +19820101 # +19850901 # +19800101 # +19000101 # +19840101 # +19820716 # +19890101 # +19000101 # diff --git a/tmp/end_unixepoch b/tmp/end_unixepoch @@ -0,0 +1,52 @@ +94690800 +157762800 +1304200800 +749430000 +-2208989361 +218242800 +204501600 +176079600 +157762800 +157762800 +220921200 +168130800 +184028400 +378687600 +231285600 +273448800 +283993200 +378687600 +323391600 +433810800 +283993200 +325980000 +883609200 +283993200 +444438000 +441759600 +315529200 +347151600 +-2208989361 +281314800 +-2208989361 +404953200 +260233200 +328658400 +-2208989361 +-2208989361 +694220400 +915145200 +-2208989361 +-2208989361 +-2208989361 +-2208989361 +347151600 +323391600 +378687600 +494373600 +315529200 +-2208989361 +441759600 +395618400 +599612400 +-2208989361 diff --git a/tmp/start b/tmp/start @@ -0,0 +1,52 @@ +19710501 # +19730101 # +19730401 # +19731101 # +19740101 # +19740301 # +19741123 # +19740101 #? +19750101 # +19750101 # +19750101 # +19750101 # +19751101 # +19760101 # +19760601 # +19761001 # +19770101 # +19770101 # +19770308 # +19770501 # +19770601 # +19771001 # +19771101 # +19771201 # +19770101 #? +19780101 # +19780101 # +19780101 # +19780101 # +19780101 # +19780201 # +19780301 # +19780401 # +19780401 # +19780701 # +19780901 #/10 +19781101 # +19790101 # +19790101 # +19790101 # +19790201 # +19790301 # ou 1975 (BNF) +19790401 # +19790401 # +19790501 # +19790601 # +19790601 # +19790601 # +19790701 # +19791107 # +19791201 # +19790101 #? diff --git a/tmp/start_unixepoch b/tmp/start_unixepoch @@ -0,0 +1,52 @@ +41900400 +94690800 +102466800 +120956400 +126226800 +131324400 +154393200 +126226800 +157762800 +157762800 +157762800 +157762800 +184028400 +189298800 +202428000 +212972400 +220921200 +220921200 +226623600 +231285600 +233964000 +244508400 +247186800 +249778800 +220921200 +252457200 +252457200 +252457200 +252457200 +252457200 +255135600 +257554800 +260233200 +260233200 +268092000 +273448800 +278722800 +283993200 +283993200 +283993200 +286671600 +289090800 +291769200 +291769200 +294357600 +297036000 +297036000 +297036000 +299628000 +310777200 +312850800 +283993200