Hey all,
I ran some simulations, of which the output is 100s of files. I've used grep to extract the vital information needed from the files. This has made my task somewhat easier. But I still need to perform some mathematical calculations (average and geometrical average) on the results of the grep command (which is saved to a txt file).
The general format of the output of grep is (just a crude example):
Code:
a-4.txt number of eggs used is ## in # cartons
b-4.txt number of eggs used is ## in # cartons
b-6.txt number of eggs used is ## in # cartons
a-6.txt number of eggs used is ## in # cartons
a-8.txt number of eggs used is ## in # cartons
b-8.txt number of eggs used is ## in # cartons
a-10.txt number of eggs used is ## in # cartons
b-10.txt number of eggs used is ## in # cartons
My aim here is to get the average number of cartons (#) needed to pack ## number of eggs. Here I want to average all the a-4, a-6, a-8, and a-10 and then all the b-4, b-6, b-8, and b-10 cartons. SO my end result is to have an average number of cartons for both a and b. As you can imagine doing this by hand with results that can go up to 100 is very time consuming. Can someone please assist me with a BASH script that can make my job simpler?
Thank you.