Here is the complete code..
What I'm trying to do is this - >
I'm trying to find the average of the values in the second column of the files . If the file has 2.54 in its name, I want to find averages from files called file_2.54_even.xls and file_2.54_odd.xls . If the fiename does not have 2.54 in its name, then simply find the average of file. For example: file_1.60.xls
#!/bin/bash
for file in pmb_mpi tau xhpl mpi_tile_io fftw ; do
for f in 2.54 1.60 800 ;do
if [ ${f} = "2.54" ]
then
echo ${file}_${f}_even_v1.xls
awk 'sum+=$2 ;END {print "Average = " , $sum/NR > ${file}_${f}_avrg.xls }' ${file}_${f}_even_v1.xls
echo ${file}_${f}_odd_v1.xls
awk 'sum+=$2 ;END {print "Average = " , $sum/NR > ${file}_${f}_avrg.xls }' ${file}_${f}_odd_v1.xls
else
echo ${file}_${f}_v1.xls
awk 'sum+=$2 ;END {print "Average = " , $sum/NR > ${file}_${f}_avrg.xls }' ${file}_{f}_v1.xls
fi
done
done