I've been trying to nut this out, but I'm stumped... I've tried to extrapolate the commands I found at How to replace epoch timestamps in a file with other formats?, but I'm can't get it yet.
My system has a command to read values from a database, one of the values I can read is in epoch time format:
[user@Dreadnaught config]# dbviewer -t Isagraf5.Resource._1.CompileDate
1488303650
If I manually copy the result to the date command, it works fine:
[user@Dreadnaught config]$ date -d@1488303650
Tue Feb 28 17:40:50 UTC 2017
I want to get this as a single command (so I can just add it to my alias list instead of having to load a sh script). I've tried all sorts of ways to pipe the result from the first command to the second, but I can't figure it out. What am I missing?
From the other referenced question, I've managed to join the result from the dbviwer query onto the date command, but not execute it.
[user@Dreadnaught config]$ dbviewer -t Isagraf5.Resource._1.CompileDate | sed 's/^//; s/\([0-9]\{10\}\)/date -d @\1/;s/$//'
date -d @1488303650
[user@Dreadnaught config]$ . dbviewer -t Isagraf5.Resource._1.CompileDate | sed 's/^//; s/\([0-9]\{10\}\)/date -d @\1/;s/$//'
-ash: /usr/bin/dbviewer: line 1: syntax error: unexpected "("
Thanks for your help...