3
Expensive;
I have a list of files (140 thousand) with date in the format Unix epoch timestamp in the file name. I need to convert each file to match its actual date by changing its name. Example: 1475279740.15044_xxx.xxx.Stats, where the epoch timestamp is 1475279740, converting gives 2016-09-30 (2016-09-30_xxx.xxx.Stats).
I have the list of files with their names in timestamp and another file with the list of names already converted, both in txt. However, I need to change/move the file containing the timestamp to the converted files.
I imagine having two for
where one opens the timestamp file list and the other for
which opens the converted files and then would just change/move with a simple command mv
.
To test, I created these two bonds for
, but only the second variable is changed in sequence, the first becomes static.
Follow the example code:
for x in $(cat timestamp.txt)
do
for y in $(cat timestamp-conv.txt)
do
echo $x convertido para $y
done
done
Expected code output:
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-24
1474566212 convertido para 2016-09-25
1474566212 convertido para 2016-09-25
The two lists are identical, line by line between the two beat the timestamp with the other already converted.
I have tried in many ways, without success!
Can you help me?
And the time, won’t you need it? It’s possible that two files have the same date, so what would differentiate them would be the time.
– Thiago Rider Augusto
No time required, only date same.
– user54154
The list with the name of the files is on
timestemp.txt
? One per line? You want to copy the file1475279740.15044_xxx.xxx.stats
to the archive2016-09-30_xxx.xxx.stats
, for example, and print out a report at the end of all converted files, that’s it?– Thiago Rider Augusto
I have a directory with 140,000 log files. Each log file is timestamped from the day it was saved. So of these 140,000 files, I have a September file on another one. As the script that does this on a daily basis, we only saw after almost two months, we will have to filter each file by its current date in timestamp, converting from timestamp to real date and save in a directory with this date. So, I need to know the days of all files to make this conversation: from 1475279740.15044_xxx.xxx.Stats to 2016-09-30_xxx.xxx.Stats. I don’t know if it’s clear, in case I’m not sorry !!
– user54154