So I have written shell script to ping a web server 86,400 times and write the output into a text file. Example of one ping below:
64 bytes from a104-100-153-112.deploy.static.akamaitechnologies.com (220.127.116.11): icmp_seq=1 ttl=60 time=12.6 ms 64 bytes from a104-100-153-112.deploy.static.akamaitechnologies.com (18.104.22.168): icmp_seq=2 ttl=60 time=17.2 ms 64 bytes from a104-100-153-112.deploy.static.akamaitechnologies.com (22.214.171.124): icmp_seq=3 ttl=60 time=11.0 ms
My first issue is I then need it to extract the value of the round trip (12.6) time from the raw ping output into a second text file. What I have right now I believe will ignore the decimal point in 12.6 and only take in the numerical values. My code below:
sed 's/.* time= \ ([0-9]* \ ). * /\1/' pingoutput.txt | sort -n > sortedtime.txt
After extracting those time values into
sortedtime.txt I read the text file and make each line (so each round trip time) into an element in a list called
timelist. It then prints both the length and the entire list to assure that the list took in all 86400 roundtrip times and they were sorted correctly. My code below:
with open("sortedtime.txt", 'r') as time: timelist =  for line in time: timelist.append(line) time.close() print timelist[0:86399] print len(timelist)
My second and last issue is I need to plot a CDF of all my values in that timelist list and display it. I am new to Python and am not too familiar with the
matplotlib.pyplot package and, so I don't understand how I would go about plotting the list elements on the x axis vs a 0 to 1 y axis.
I am working in Linux, any help is greatly appreciated!