Since you have not shown any code, I will assume you are just looking for an approach/algorithm:
- Create a list of files using either glob or a combination of opendir, readdir, grep and -f.
- Use a for loop and open each file.
- Use a while loop to read in each line of the file.
- split the line and keep a running sum of column 3 values. Also keep track of the number of lines.
- After all lines of all files have been read, divide the sum by the total number of lines.