This file contains hidden or 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
#!/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 ""; } |