echo "Now checking for existing output" if [ "GIS_stat_out" ]; then echo "Firstly delete old output" rm GIS_stat_out fi touch GIS_stat_out for i in `cat GIS_in` do echo echo "Now processing scenario $i" cp gisstat ../output/$i cd ../output/$i gisstat gwr 1970 1971 2000 awk {'print $3'} stat-average-gwr.dat > da cd ../../ausw paste GIS_stat_out ../output/$i/da > dada mv dada GIS_stat_out done # Average, Min, Max and awk '{print NF}' GIS_stat_out awk '{sum=0; for (i=1; i<=NF; i++) { sum+= $i } print NR, " = ", sum/(i-1)}' GIS_stat_out > GIS_gwr_ave awk '{m=$1;for(i=1;i<=NF;i++)if($i GIS_gwr_min awk '{sum=0; sumsq=0; for (i=1; i<=NF; i++) { sum+= $i; sumsq+= $i^2} print sum, sum/(i-1), sumsq}' GIS_stat_out > GIS_gwr_sqrt