
###############################################
Summary of analyze data  bash scripts.
###############################################


Two versions of analysze data:
adata1.sh
adata2.sh

analyzeData.sh  : This is data analysis script, reads a data file and invokes findMean.awk

findMean.sh / findMean.awk


###############################################
analyzeData.sh  : this is an example data analysis script. It is intended to read a data file
that contains multiple results (one per line) with each result consisting of a number of fields.
###############################################

The specific example we use is produced by ping:
  'ping -c 1000 www.ces.clemson.edu > ping.rawdata' 


If we run ping only 2 iterations, we should see the following:

ping -c 2 www.ces.clemson.edu
PING pan.ces.clemson.edu (130.127.200.19) 56(84) bytes of data.
64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=1 ttl=61 time=11.7 ms
64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=2 ttl=61 time=15.0 ms

--- pan.ces.clemson.edu ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 11.757/13.379/15.001/1.622 ms

We want the analysis script to analyze a data file such as ping.rawdata allowing
use to specify which field we are interested in.
We can redirect the output into a file.  


The script parameters are:
arguement 1:    input data file name
arguement 2:    field start delimiter
arguement 3:    field stop delimiter
arguement 4:    output (results) data file name


Example using the ping (2 RTT samples) shown above (input in ping.rawdata2)
./analyzeData.sh ping.rawdata time= ' ms' ping.dat

The first several lines of ping.rawdata are:
PING www.google.com (74.125.30.103) 56(84) bytes of data.
64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=8 ttl=38 time=122 ms
64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=10 ttl=38 time=81.8 ms


The first several lines of ping.dat are:
122
81.8


To plot the PDF of the ping time series data:

-run plotPDF.m in matlab. It is set to load the data file ping.dat.
-If you want to run on octave:
  1. sudo apt-get install octave
  2. to start octave in gui mode,  octave --force-gui   
  3  the go to the directory with plotPDF and run         

###############################################

findMean.script  :  a script that takes a single parameter specifying an input file.
                   The script calls findMean.awk which computes the mean of field 1
                   of the data file.

###############################################

