#!/bin/csh

##cd /scratch2/portfolios/NCEPDEV/ptmp/Jili.Dong/08l/hycom_archv/backup/ 
##cd /scratch2/portfolios/NCEPDEV/ptmp/Jili.Dong/hwrf/2014101218/08l/GONZALO.2014101218/save_fcst_R50W40_radoff
cd /scratch2/portfolios/NCEPDEV/ptmp/Jili.Dong/Issac

##ln -sf $CDSAVE/HyHWRF-2014/fix/hwrf-hycom/hwrf_rtofs_hat12.mid.regional.grid.a  regional.grid.a
##ln -sf $CDSAVE/HyHWRF-2014/fix/hwrf-hycom/hwrf_rtofs_hat12.mid.regional.grid.b  regional.grid.b
##ln -sf $CDSAVE/HyHWRF-2014/fix/hwrf-hycom/hwrf_rtofs_hat12.mid.regional.depth.a  regional.depth.a
##ln -sf $CDSAVE/HyHWRF-2014/fix/hwrf-hycom/hwrf_rtofs_hat12.mid.regional.depth.b  regional.depth.b
##ln -sf $CDSAVE/HyHWRF-2014/parm/hwrf_rtofs_hat12.mid.fcst.blkdat.input blkdat.input
ln -sf $CDSAVE/ALL/archive/src_2.2.35/archv2ncdf3z .
cp /scratch2/portfolios/NCEPDEV/marine/save/Jili.Dong/ALL/archive/src_2.2.35/ncdf3z_010_0021_016.com .

##set fileall = `ls hwrf_rtofs_*174*_*.a`
set fileall = `ls *archv*.a`

foreach file ($fileall)
##echo $file
##set new_file_name = `ls $file | cut -c1-33`
# for ideal case change to 17
set new_file_name = `ls $file | cut -c1-26`
echo $new_file_name
sed "s/dummy/$new_file_name/g" ncdf3z_010_0021_016.com > archv2ncdf3z_multi_tmp.com
chmod +x archv2ncdf3z_multi_tmp.com
./archv2ncdf3z_multi_tmp.com
end 



##ls hwrf_rtofs_hat14.t00z.2014_286_01.a | cut -c1-33
##./archv2ncdf3z_multi_tmp.script