Skip to content

Instantly share code, notes, and snippets.

@mrmorris
Created May 23, 2020 16:18
Show Gist options
  • Save mrmorris/9184cf1fb6a80da1dd09c4e8d6db9f3e to your computer and use it in GitHub Desktop.
Save mrmorris/9184cf1fb6a80da1dd09c4e8d6db9f3e to your computer and use it in GitHub Desktop.
#!/bin/sh
# tail -F $HISTFILE | ./historymaker.sh
awk '
BEGIN { print "Beginning" }
# $0 ~ / ([0-9]+):[0-9]+;(.+)/ { print $0}
match($0, / ([0-9]+):[0-9]+/) {print "\033[37m"strftime("%m/%d/%Y @%H:%M:%S", substr($0, RSTART+1, RLENGTH-1))}
match($0, /;(.+)/) {print "\033[32m" "" substr($0, RSTART+1, RLENGTH-1)}
END { print "done"}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment