Skip to content

Instantly share code, notes, and snippets.

@jamerfort
Created May 9, 2012 18:33
Show Gist options
  • Save jamerfort/2647770 to your computer and use it in GitHub Desktop.
Save jamerfort/2647770 to your computer and use it in GitHub Desktop.
Add a timestamp to each line of standard input.
#!/bin/ksh
# Examples:
# tail -f some.log | ts
# ping -i 5 someserver | ts
while read LINE
do
echo "$(date $@): $LINE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment