Last active
May 11, 2016 15:23
-
-
Save wytten/84a0a13547d697afb0059904cea02558 to your computer and use it in GitHub Desktop.
Count log events per hour using awk, for a log file containing messages prefixed with date and time e.g., '2016-04-18 02:03:07'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$awk -F: '/logMessageOfInterest/ {counts[$1] = counts[$1] + 1; } END { for (val in counts) print val, counts[val]; }' LOG.TXT | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to turn that into a script see http://unix.stackexchange.com/questions/120788/pass-shell-variable-as-a-pattern-to-awk