On Monday, 23 November 2020 21:47:11 GMT Jack wrote:
> 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
> }
 
I didn't read the earlier msgs in this thread,
but I've long used my own Bash function (in  .bashrc ) :

  # translate UNIX date to human-readable
  function th { date -d @$1 ; }

eg the last line in  emerge.log  is  "1606047812:  *** terminating." ,
so I hilite the number & drop it into the function :

  th 1606047812

which gives the timestamp

  Sun Nov 22 07:23:32 AM EST 2020

HTH

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatcadotinterdotnet


Reply via email to