Skip to content

Instantly share code, notes, and snippets.

@jayankandathil
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jayankandathil/10938624 to your computer and use it in GitHub Desktop.
Save jayankandathil/10938624 to your computer and use it in GitHub Desktop.
# ------------------------------------------------
# AWK script to print unique user IDs in a folder
# containing a collection of CQ's access.logs
# ------------------------------------------------
# Usage : gawk -f /opt/scripts/parse-cq-access-logs.awk /opt/aem/crx-quickstart/logs/access.log.*
# Author : Jayan Kandathil
# Last updated : April 16, 2014
# Version : 0.1
# Set delimiter character, Start timing
BEGIN { FS = " "; start_time = systime()}
{
# Add 3rd field to array (if unique)
array[$3]++
}
# Print results and total time taken
END { print "\n"; for (value in array) { print value }; end_time = systime(); print "\nTook " (end_time - start_time) " second(s), processed a total of " NR " lines in all files" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment