Skip to content

Instantly share code, notes, and snippets.

@nhoag
Created December 23, 2015 18:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhoag/6d4dc33feb64c7c7fc29 to your computer and use it in GitHub Desktop.
Save nhoag/6d4dc33feb64c7c7fc29 to your computer and use it in GitHub Desktop.
Calculate bandwidth per minute from access log
#!/bin/bash
cat access.log \
| awk -F' ' '{
time = substr($4, 2, 17);
times[time] = time;
bandwidth[time] += $10
} END {
for (t in times) print times[t],bandwidth[t]/1024/1024
}' \
| column -t \
| sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment