Skip to content

Instantly share code, notes, and snippets.

@dancmeyers
Created August 2, 2016 11:12
Show Gist options
  • Save dancmeyers/5e2432366f63795356a55ed21b944093 to your computer and use it in GitHub Desktop.
Save dancmeyers/5e2432366f63795356a55ed21b944093 to your computer and use it in GitHub Desktop.
cat <INPUT FILE> | awk '{ bucket = int(($NUM) / <BUCKET SIZE>) * <BUCKET SIZE> ; arr[bucket]++} END { for (i in arr) {print i, arr[i] }}' | sort -g
# e.g.
#
# cat access.log.app025.26072016.txt | awk '{ bucket = int(($6 / 1000000) / 100) * 100 ; arr[bucket]++} END { for (i in arr) {print i, arr[i] }}' | sort -g
# $6 / 1000000 because apache request times are microseconds by default
# bucket '0' is 0-100, '100' is 100-200, etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment