[Solved] calculating average over many files [closed]


I forgot almost everything about bash scripting. but I think you can do something like this.

files=(file1 file2 file3 file4)
for i in `seq  4`
do
  j=$(($i-1))
  f[$j]=`cat ./temp/${files[$i]} | awk '{print $2}' `
done

for i in `seq 0 1799`
do
  sum=0
  rowValue=0
  for j in `seq 0 3`
  do
    fileContent=(${f[$j]})
    rowValue=`echo ${fileContent[$i]} `
    sum=$(($sum + $rowValue))    
  done
  echo "sum is" $i $sum
done

0

solved calculating average over many files [closed]