Script tips and tricks
Do you know a neat trick that could save someone hours of agony at the command line? Put it here!
Log file timestamps in “epoch” format? That is, seconds since January 1, 1970? Use “epoch2timestamp” from /kroot/src/util/instr/scripts.
From /net/lehoula/local/kroot/var/log/watch_hirot_monitor.log
1666139858.878 watch_hirot: rotpdest_update: dcs_rotstat=1281666139858.878 watch_hirot: rotpdest_update: rotator is disabled1666139859.058 watch_hirot: irotmode_callback: IROTMODE=4 action ignored; status= 3
Use: tail -50 /net/lehoula/local/kroot/var/log/watch_hirot_monitor.log | awk '{line = $0; var = system("epoch2timestamp -n " $1); print var, line}'
yields:
2022-10-18T14:37:38.8780 1666139858.878 watch_hirot: rotpdest_update: dcs_rotstat=1282022-10-18T14:37:38.8780 1666139858.878 watch_hirot: rotpdest_update: rotator is disabled2022-10-18T14:37:39.0580 1666139859.058 watch_hirot: irotmode_callback: IROTMODE=4 action ignored; status= 3