Skip to content

Instantly share code, notes, and snippets.

View elgholm's full-sized avatar

Charlie Elgholm elgholm

View GitHub Profile
@elgholm
elgholm / calc_bandwidth.sh
Last active October 5, 2015 11:37
Simple script for calculating bandwidth-requirements from a common Apache logfile
#!/bin/bash
# Simple script for calculating bandwidth-requirements from a common Apache logfile
# Written 2015-10-05 by Charlie Elgholm
# Usage: ./calc_bandwidth.sh logfile
cat $1 | awk '
function left(s, s2){ t=index(s, s2); if(t>0) return substr(s, 1, t-1); else return s; }
function right(s, s2){ t=index(s, s2); if(t>0) return substr(s, t+length(s2)); else return ""; }