Skip to content

Instantly share code, notes, and snippets.

@macieksk
Created July 26, 2011 12:38
Show Gist options
  • Save macieksk/1106656 to your computer and use it in GitHub Desktop.
Save macieksk/1106656 to your computer and use it in GitHub Desktop.
dmesg messages time retrieval (hours or minutes ago)
#!/bin/bash
#Usage: dmesg | grep eth3 | dmesg_time.sh
for time in $(egrep -o '[0-9]+\.[0-9]+')
do
TIME="`echo "($(awk '{print $1}' /proc/uptime) - $time) / 60 / 60" | bc`h" # Hours
TIME="$TIME or `echo "($(awk '{print $1}' /proc/uptime) - $time) / 60" | bc`m" # Minutes
echo "$TIME ago"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment