Skip to content

Instantly share code, notes, and snippets.

@nk23x
Created March 17, 2015 11:57
Show Gist options
  • Save nk23x/956dc420591d13320ff4 to your computer and use it in GitHub Desktop.
Save nk23x/956dc420591d13320ff4 to your computer and use it in GitHub Desktop.
dmesg timestamp human readable
#!/bin/sh
## for systems (like sles 11) wher dmesg does not support parameters -T or --ctime
## source: https://www.verboom.net/blog/index.html?single=20110927.0
dmesg | gawk -v uptime=$( grep btime /proc/stat | cut -d ' ' -f 2 ) '/^[[ 0-9.]*]/ { print strftime("[%Y/%m/%d %H:%M:%S]", substr($0,2,index($0,".")-2)+uptime) substr($0,index($0,"]")+1) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment