On 2020.11.23 15:00, Dale wrote:
Matt Connell (Gmail) wrote:
> On Mon, 2020-11-23 at 19:24 +0100, Dr Rainer Woitok wrote:
>> *blush* Even though I'm using "date" since umpteen years, up to
now I
>> was not aware of this "@..." syntax. You're perfectly right,
that's ex-
>> actly what I was looking for.
> I wasn't either, until I read the man page. Just goes to show you
> never outgrow good documentation.
I found out when I was trying to convert emerge.log and its date/time
stamp. Before that, I had no idea the date command did that either.
I
just knew it was used to set the system time and date manually, like
on
a new install when it is to far off for ntpdate or chrony to correct.
I do wish the emerge.log time stamp was like it is in messages. It
just
puts the date in something you can just read. :/
Dale
For many years, I've had this small script in my home directory -
unfortunately I rarely remember to use it. I have no idea where I got
it, but it's got a timestamp of about four years ago. However, now
that I actually look at it, the author is a frequent contributor to
this list, so it was likely mentioned here.
#!/usr/bin/awk -f
#########################################################################
# log-emerge:
#
# A filter which converts the time stamp on emerge log files to a human
# readable form.
#
# Written by Alan Mackenzie <[email protected]>, 2015-10-20.
# This script is in the public domain.
#
# To use, pipe all or part of a log file through this filter.
#########################################################################
{
sec = strtonum(substr($1, 1, 11))
$1 = strftime("%Y-%m-%d %H:%M:%S %z", sec, 0) ":"
print
}