Example CSH monthly-averaging script:
—————–
#! /bin/csh
set path1=’/work/scratch/pmcguire/config/outputs/’
set prefix=’Euro44_bvv_nancil_CTL-BCJ-GL_jules-vn4.9p_u-as052globeE.6-hourly.’
set prefix2=’Euro44_bvv_nancil_CTL-BCJ-GL_jules-vn4.9p_u-as052globeE_monmean_’

foreach yr (1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012)
echo monmean ${yr}
#the shifttime of 1 sec is for the midnight of Dec 31 in the time bounds equalling 00:00:00 of Jan 1 of the next year
cdo monmean -shifttime,-1sec ${path1}${prefix}${yr}.nc ${prefix2}${yr}.nc
end

cdo mergetime ${prefix2}1979.nc ${prefix2}1980.nc ${prefix2}1981.nc ${prefix2}1982.nc ${prefix2}1983.nc ${prefix2}1979_1983.nc

cdo mergetime ${prefix2}1984.nc ${prefix2}1985.nc ${prefix2}1986.nc ${prefix2}1987.nc ${prefix2}1988.nc ${prefix2}1984_1988.nc

cdo mergetime ${prefix2}1989.nc ${prefix2}1990.nc ${prefix2}1991.nc ${prefix2}1992.nc ${prefix2}1993.nc ${prefix2}1989_1993.nc

cdo mergetime ${prefix2}1994.nc ${prefix2}1995.nc ${prefix2}1996.nc ${prefix2}1997.nc ${prefix2}1998.nc ${prefix2}1994_1998.nc

cdo mergetime ${prefix2}1999.nc ${prefix2}2000.nc ${prefix2}2001.nc ${prefix2}2002.nc ${prefix2}2003.nc ${prefix2}1999_2003.nc

cdo mergetime ${prefix2}2004.nc ${prefix2}2005.nc ${prefix2}2006.nc ${prefix2}2007.nc ${prefix2}2008.nc ${prefix2}2004_2008.nc

cdo mergetime ${prefix2}2009.nc ${prefix2}2010.nc ${prefix2}2011.nc ${prefix2}2012.nc ${prefix2}2009_2012.nc

cdo mergetime ${prefix2}1979_1983.nc ${prefix2}1984_1988.nc ${prefix2}1989_1993.nc ${prefix2}1994_1998.nc ${prefix2}1999_2003.nc ${prefix2}2004_2008.nc ${prefix2}2009_2012.nc ${prefix2}1979_2012.nc

cdo mergetime ${prefix2}1980.nc ${prefix2}1981.nc ${prefix2}1982.nc ${prefix2}1983.nc ${prefix2}1980_1983.nc

cdo mergetime ${prefix2}1980_1983.nc ${prefix2}1984_1988.nc ${prefix2}1989_1993.nc ${prefix2}1994_1998.nc ${prefix2}1999_2003.nc ${prefix2}2004_2008.nc ${prefix2}2009.nc ${prefix2}1980_2009.nc
—————–