Skip to content

Instantly share code, notes, and snippets.

@georgebashi
Created April 12, 2013 16:33
Show Gist options
  • Save georgebashi/5373314 to your computer and use it in GitHub Desktop.
Save georgebashi/5373314 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ ! -z "$@" ]; then
exec tail -f "$@" | $0
fi
TIME="$(date +%s%N)"
while IFS= read -r line; do
NEW_TIME="$(date +%s%N)"
printf "%6.2f %s\n" "$(echo "scale=2;(${NEW_TIME} - ${TIME})/(1*10^09)" | bc)" "$line"
TIME="$NEW_TIME"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment