Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:45:11 UTC

view on githubraw file Latest commit 91bb1064 on 1998-08-23 15:35:10 UTC
91bb1064c1 Chri*0001 #!/bin/csh -f
                0002 #
                0003 # Usage: nc oldvar newvar filelist
                0004 #
                0005 
                0006 if ( $#argv < 3 ) then
                0007  echo "Usage: $0 oldvar newvar filelist"
                0008  exit
                0009 endif
                0010 
                0011 set  oldvar = "$1";
                0012 set  newvar = "$2";
                0013 shift; shift;
                0014 
                0015 echo Replace \""$oldvar"\" with \"$newvar\" '[yes/(no)]'
                0016 set response = ( $< )
                0017 if ( "$response" != "yes" ) then
                0018  exit
                0019 endif
                0020 
                0021 set savedir = ( nc-$$ )
                0022 mkdir $savedir
                0023 
                0024 foreach curfile ( $* )
                0025 
                0026  echo Substituting \"$newvar\" for \""$oldvar"\" in file \"$curfile\".
                0027  cp   $curfile $savedir/${curfile:t}.before
                0028  cat  $savedir/${curfile:t}.before | sed s/'\([^a-zA-Z_]\)\('"$oldvar"'\)/\1'$newvar'/g' > $curfile
                0029 
                0030 end
                0031 #
                0032 # cat $oldfile | sed s/'\([^a-zA-Z]\)\([Nn][Zz]\)/\1Nr/' > $newfile
                0033 #