Skip to content

Instantly share code, notes, and snippets.

@caljess599
Created October 4, 2017 17:18
Show Gist options
  • Save caljess599/feea1d303dfaf4030be0f2f10c6df306 to your computer and use it in GitHub Desktop.
Save caljess599/feea1d303dfaf4030be0f2f10c6df306 to your computer and use it in GitHub Desktop.
shell script to timestamp input piped to it, if output is not empty
#!/bin/bash
while read x; do
if [ -n "$x" ]; then
echo -n `date +%Y-%m-%dT%H:%M:%S`
echo -n " "
echo $x
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment