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 650d2c0e26493532844c3bcd01a1bcb1fb8954ee
parent b0da84400460be573820b9ff66c3610397ea9421
Auteurice: vi Coloc <vi@coloc.re>
Date:   Sun,  3 Nov 2024 21:35:35 +0100

 bug w redirection tee resolved it

Diffstat:
Msrc/utils/date_epoch.sh | 21+++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/utils/date_epoch.sh b/src/utils/date_epoch.sh @@ -24,7 +24,9 @@ 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' +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 } @@ -32,22 +34,21 @@ 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 -n1 date -j +%s | tee tmp/start_unixepoch - +cut -f1 tmp/start | +xargs -I XX -d'\n' -n1 date +%s --date="XX" | +tee tmp/start_unixepoch cut -f1 tmp/end | -xargs -n1 date -j +%s > tmp/end_unixepoch +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 # append the epoch time to the one tsv cat tmp/dateEpoch_final.tsv | -sed '1s/^/start_unixepoch end_unixepoch \\/' | -tr '\' '\n' > tmp/dateEpoch_final.tsv - - +sed '1s/^/start_unixepoch end_unixepoch @ /' | +tr '@' '\n' | tee tmp/dateEpoch_final.tsv #git restore src/db.tsv