Skip to content

Instantly share code, notes, and snippets.

@nogweii
Created May 13, 2012 17:12
Show Gist options
  • Save nogweii/2689343 to your computer and use it in GitHub Desktop.
Save nogweii/2689343 to your computer and use it in GitHub Desktop.
A script that will measure how fast, over time, a file was downloaded (CSV)
wget http://URL/BIG_FILE -O/dev/null 2>&1 1>/dev/null | awk '/^ / { speed=$8 } /^\d/ { speed = $7 } { if (NR % 500 == 0) { print "\n" } if (index($speed, "M")) { print substr($speed, 1, index($speed, "M")-1)*1024 } else if (index($speed, "K")) { print substr($speed, 1, index($speed, "K")-1) } else { print 0 } }' | tr '\n' ',' | sed "s/,,/\n/g;s/^,//" > speeds.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment