Hi
I get problems when using the following command :
cat logs | awk -F";" '{ system("date -d "1970-01-01 UTC+0100 $1 seconds""); }'
date: date invalide `1968641199401200'
date: date invalide `1968641199381709'
this is what i have in my log file :
cat logs
1199401200;a
1199381709;b
I don't know where this 196864 comes form
Any idea ?
Thx
while IFS=";" read a b
do
date -d "1970-01-01 UTC+0100 $a seconds"
done < file
thx for this idea but it does not work for me
I made something that gives the same output your code should give but this is not what i am searching for :
for mytimestamp in $(cat logs| awk -F";" '{ print $1; }'); do echo $(date -d �1970-01-01 UTC+0100 $mytimestamp seconds�); done
What i want is to replace all the timestamps (first field) in a log file with the date in UTC+0100 format but i want to keep the other fields (file scheme)...
If you have GAWK you can use the strftime function or you can fit the script of gostdog74 like:
while IFS=";" read a b
do
echo $(date -d "1970-01-01 UTC+0100 $a seconds")";"$b
done < file
Regards