Since your awk command is inside single quotes, the shell variables file and f will not be extended. This is why you get awk errors.
I would use the following script:
#!/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 flist=${file}_${f}_even_v1.xls ${file}_${f}_odd_v1.xls else flist=${file}_${f}_v1.xls fi cat ${flist} | awk ' s+=$2; END {print "Average = ",$s/NR} ' >${file}_${f}_avrg.xls
This will just install flist for both files or one file, depending on whether f 2.54 or not, then click this list of files through one awk script.
paxdiablo
source share