#!/bin/sh
echo "====================="
for file in $(echo `ls *.nc `) ; do
	echo "file: ${file}"
	# sed ok for filename in style: q_10.1989.26JAN2010_orca2.nc
	# sed ok for filename in style: filename.date.DDMMYYYY_orca2.nc
        # nuovofile=`ls $file | sed -e "s@\.\([0-9]*\)\..*\(_[^\.]*\)@\2_\1@"
	newfile=`ls $file | sed -e "s@\.\([0-9]*\).*\(_[^\.]*\)@\2_\1@"`
	echo "new file: $newfile"
	`mv $file $newfile`
done
echo "@@@@@@@@@@@@@@@@@@@@@@@@"
