I would like to view a text file with awk/grep which contains a Unix timestamp in the first column.
How can I convert it to a human-readable time while viewing?
Unix Timestamp – Convert Unix Timestamp to Human-Readable Time
awkdatetext processingtimestamps
Best Answer
If the line starts with the unix timestamp, then this should do it:
perl -p
invokes a loop over the expression passed with-e
which is executed for each line of the input, and prints the buffer at the end of the loop.The expression uses the substition command
s///
to match and capture a sequence of digits at the beginning of each line, and replace it with the local time representation of those digits interpreted as a unix timestamp./e
indicates that the replacement pattern is to be evaluated as an expression.