A Simple Uptime Output Method

If you've ever tried to parse the output of "uptime", you know it can be complicated. There's a simpler solution: Use the raw numbers from /proc/uptime. Here's a simple script that spits out the days and remaining time in digital clock format:

    cat /proc/uptime | awk '{printf "%d%s%.2d%s%.2d%s%.2d%s" , $1/86400 , " days, " , $1%86400/3600 , ":" , $1%86400%3600/60 , ":" , $1%86400%3600%60 , "\n"}'

Note that the output can be changed to your needs. See the AWK Tutorial for more info on using modulus (%) in calculations, and string formatting (i.e., %d and %s)