Skip to content

Instantly share code, notes, and snippets.

@sbeckeriv
Created May 10, 2012 16:43
Show Gist options
  • Save sbeckeriv/2654391 to your computer and use it in GitHub Desktop.
Save sbeckeriv/2654391 to your computer and use it in GitHub Desktop.
time geeklet
expr `date -j -f "%d/%m/%Y %H:%M:%S" "7/5/2012 09:54:00" "+%s"` - `date "+%s"` | awk '{ if( int( $1/86400 ) < 0 ) printf "@ Amazon for ⟶ %d days, " , int( $1/86400 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 ) printf "%d hours, " , int( $1%86400/3600 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 || int( $1%3600/60 ) < 0) printf "%d minutes, " , int( $1%3600/60 ) ; if( int( $1/86400 ) < 0 || int( $1%86400/3600 ) < 0 || int( $1%3600/60 ) < 0 || $1%60 < 0 ) printf "%d seconds" , $1%60 ; else printf "Hello!" }' | sed -E 's/-/ /' | sed -E 's/-/ /' | sed -E 's/-/ /' | sed -E 's/-/ /'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment