Question: Write a script that calculates the mean and standard deviation using a loop for columns 9- 13 in the data file and writes all the

Write a script that calculates the mean and standard deviation using a loop for columns 9- 13 in the data file and writes all the results to new file called means_and_sds.txt. Make sure you know which means and standard deviations go with which column. (70 points).

How do you use a for loop (UNIX on Cygwin terminal) to take a separate mean and standard deviation for each column? Using this script:

for i in $9 $10 $11 $12 $13

do

awk -F"," '{sum+=$i; counter+=1; sumsq+=$i*$i}END{print "Average\t" sum/counter "\t" sqrt(sumsq/counter-(sum/counter)^2)}' file.csv

done

I just keep getting the same numbers repeated 4 times.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!