1
I'm a bit lost to create a json from few files. I have several files like named : CLT.txt, LYO.txt .... Inside of us I have date + value : dd/mm/yyyy hh:mm xxxxx
I add new line on each file every 5 minutes
examples : CLT.txt
01/01/2020 00:00 45
01/01/2020 00:05 457
01/01/2020 00:10 458
01/01/2020 00:15 402
01/01/2020 00:20 585
...
02/01/2020 00:00 57
02/01/2020 00:05 86
02/01/2020 00:10 45
02/01/2020 00:15 402
02/01/2020 00:20 104
...
LYO.txt
01/01/2020 00:00 70
01/01/2020 00:05 221
01/01/2020 00:10 315
01/01/2020 00:15 57
01/01/2020 00:20 420
...
02/01/2020 00:00 50
02/01/2020 00:05 92
02/01/2020 00:10 32
02/01/2020 00:15 125
02/01/2020 00:20 10
...
I have around 15 files like that.
So in the end I would like to get only one json file created each 5 minutes with this format :
{
"CLT": {
"01/01/2020": {
"00:00": 45,
"00:05": 457,
"00:10": 458,
"00:15": 402,
"00:20": 585
...
},
"02/01/2020": {
"00:00": 57,
"00:05": 86,
"00:10": 45,
"00:15": 402,
"00:20": 104
...
}
},
"LYO": {
"01/01/2020": {
"00:00": 70,
"00:05": 221,
"00:10": 315,
"00:15": 57,
"00:20": 420
...
},
"02/01/2020": {
"00:00": 50,
"00:05": 92,
"00:10": 32,
"00:15": 125,
"00:20": 10
...
}
}
}
if you have a simple idea, I'm interested. All processes are done on Ubuntu LTS 19 machine.
Thanks
thanks for your scripts but they don't do exactly what I want... it seems CLT, LYO are used one after other so the json output is not like I want – nvanhaute – 2019-11-10T15:59:50.683
I just tried again and the output JSON is exactly the same as in your own example? – user1686 – 2019-11-10T16:31:23.570
ah yeah right, it seems I did not try well, now it works well thanks – nvanhaute – 2019-11-11T18:51:28.287