Created
June 25, 2013 09:44
-
-
Save robbi5/5857274 to your computer and use it in GitHub Desktop.
Parse a wget output for time, day, speed, url, proxy ip and proxy port
This file contains 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
BEGIN { | |
STARTTIME=systime() | |
} | |
/--/ { | |
# $1 = day | |
# $2 = time | |
gsub(/--/, "", $1); | |
gsub(/--/, "", $2); | |
DAY=$1 | |
TIME=$2 | |
URL=$3 | |
# remove windows newline from url | |
gsub(/[\n\r]/, "", URL) | |
} | |
/proxy\|/ { | |
# $3 = proxy|...|: | |
split($3, PROXYDATA, "|") | |
PIP=PROXYDATA[2] | |
# remove dots and newline | |
gsub(/[\:\.\n\r]/, "", PROXYDATA[3]) | |
PPORT=PROXYDATA[3] | |
} | |
/saved/ { | |
gsub(/\(/, "", $3) | |
gsub(/\)/, "", $4) | |
SPEED=$3 | |
SIZE=$4 | |
if(SIZE == "MB/s") { | |
SPEED=SPEED * 1000 | |
} | |
print TIME ";" DAY ";" SPEED ";" URL ";" PIP ";" PPORT | |
} | |
END { | |
ENDTIME=systime() | |
print "" | |
print "---" | |
print "Started: " STARTTIME | |
print "Ended: " ENDTIME | |
# for a msec duration | |
# use `time` | |
} |
This file contains 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
--2012-12-12 14:55:45-- http://www.***.de/arbeit/test.data | |
Resolving proxy... 10.86.200.16 | |
Connecting to proxy|10.86.200.16|:8080... connected. | |
Proxy request sent, awaiting response... 200 OK | |
Length: 904704 (884K) [text/plain] | |
Saving to: `test.data' | |
0K .......... .......... .......... .......... .......... 5% 157M 0s | |
50K .......... .......... .......... .......... .......... 11% 179M 0s | |
100K .......... .......... .......... .......... .......... 16% 236M 0s | |
150K .......... .......... .......... .......... .......... 22% 225M 0s | |
200K .......... .......... .......... .......... .......... 28% 272M 0s | |
250K .......... .......... .......... .......... .......... 33% 190M 0s | |
300K .......... .......... .......... .......... .......... 39% 268M 0s | |
350K .......... .......... .......... .......... .......... 45% 257M 0s | |
400K .......... .......... .......... .......... .......... 50% 211M 0s | |
450K .......... .......... .......... .......... .......... 56% 331M 0s | |
500K .......... .......... .......... .......... .......... 62% 203M 0s | |
550K .......... .......... .......... .......... .......... 67% 256M 0s | |
600K .......... .......... .......... .......... .......... 73% 218M 0s | |
650K .......... .......... .......... .......... .......... 79% 313M 0s | |
700K .......... .......... .......... .......... .......... 84% 328M 0s | |
750K .......... .......... .......... .......... .......... 90% 210M 0s | |
800K .......... .......... .......... .......... .......... 96% 268M 0s | |
850K .......... .......... .......... ... 100% 249M=0,004s | |
2012-12-12 14:55:45 (233 MB/s) - `test.data' saved [904704/904704] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment