Created
February 7, 2017 07:42
-
-
Save fcolista/3b62c1a67f8c6d22ad9943dde89941fb to your computer and use it in GitHub Desktop.
dmesg output date in a human readable way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# It's better to have dmesg logging in a human readable way | |
base=$(cut -d '.' -f1 /proc/uptime); | |
seconds=$(date +%s); | |
dmesg | sed 's/\]//;s/\[//;s/\([^.]\)\.\([^ ]*\)\(.*\)/\1\n\3/' | | |
while read first; do | |
read second; | |
first=`date +"%d/%m/%Y %H:%M:%S" --date="@$(($seconds - $base + $first))"`; | |
printf "[%s] %s\n" "$first" "$second"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment