Convert all Unix Time in a file to human date

2015-05-10T20:25:45

I want to replace all the UNIX time in a a JSON data file with the same UNIX time followed by a human readable date format.

For example, I want to replace "1234567890123456" (time in microsecond) with "1234567890123456,2009-02-14,00:31:30,sat".

I tried with

sed -r 's/([0-9]{16})/\1'"`date -d @ \1`"'/g'

but it doesn't work. I'm new in UNIX world, can you suggest me a solution? Thank you so much.

Cordiality

I attach a sample of my JSON file:

{
  "example": [
    {
      "query": {
        "text": "string 1",
        "id": [
          {
            "timestamp": "1234567890123456"
          }
        ]
      }
    },
    {
      "query": {
        "text": "string 2",
        "id": [
          {
            "timestamp": "1234567891123456"
          }
        ]
      }
    },
    {
      "query": {
        "text": "string 3",
        "id": [
          {
            "timestamp": "1234567893123456"
          }
        ]
      }
    }
  ]
}

Copyright License:
Author:「Jean S.」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/30151378/convert-all-unix-time-in-a-file-to-human-date

About “Convert all Unix Time in a file to human date” questions

I want to replace all the UNIX time in a a JSON data file with the same UNIX time followed by a human readable date format. For example, I want to replace "1234567890123456" (time in microsecond) ...
First I have an Unix epoch time 1270787111. Then based on this website: http://untangible.com/2009/01/covert-unix-epoch-dates-in-microsoft-excel-including-timezone-examples.html, I convert the nu...
I have to convert date and time returned by ls of rsync into Unix epoch time float as returned by time.time(). For me here at this moment it looks like: 2017/05/24 hh:mm:ss. But as far as I know i...
The database query is returning the date and time in a unix timestamp. I am trying to use clojure to convert this into human readable time and then split the date and time into two separate columns...
I am a newbie and starting programming with python. I Have a CSV file with two columns. The first is with Unix Timestamps. I want to convert this into human date using pandas. What I have till now:
Can anyone help , i want to to make simple script as anyone insert human date like 2013 - 9 - 25 19:10:00 P.M to milliseconds Unix . is it possible using strtotime. I want anyone to show me how...
Is there a MySQL function which can be used to convert a Unix timestamp into a human readable date? I have one field where I save Unix times and now I want to add another field for human readable d...
We are trying to convert unix timestamp to human readable time when running mysql commands. For the unix date we have this working command select FROM_UNIXTIME(registered) AS "ResolutionDateLine" ...
How can human readable date time format(yyyy.mm.dd hh:mm:ss ) be converted into Unix timestamp? For example I have following date 2019.07.12 08:00:00 that need to be converted into unix time forma...
Is there a contemporary way to convert unix timestamps to a human readable date? Since I want to circumnavigate the year 2038 problem, I want to use int64s. I target to convert e. g. 1205812558 to ...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.