Skip to content

Instantly share code, notes, and snippets.

@vsaw
Last active December 21, 2015 01:39
Show Gist options
  • Save vsaw/6229181 to your computer and use it in GitHub Desktop.
Save vsaw/6229181 to your computer and use it in GitHub Desktop.
Adds a timestamp to console output.To use just type: `cat /dev/ttyUSBn | timestamp.sh`
#!/bin/sh
# If Millisecond precision is required for the output uncomment the following
# line
#
# awk '{ system("date +%T.%N"); print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush(); }'
# Regular second precision timestamps
awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush(); }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment