home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / Dmake / unix / rename < prev    next >
Encoding:
Text File  |  1996-07-05  |  368 b   |  14 lines  |  [TEXT/R*ch]

  1. #!/bin/csh
  2. # rename: change the string arg1 in the names of files in current directory
  3. #         to the string in arg2
  4.  
  5. if ($#argv != 2 ) then
  6.   echo "Usage: $0 pat1 pat2 -- rename files with pattern1 to pattern2"
  7. else
  8.   foreach i ( *$1* )
  9.     mv $i `echo $i | sed -n s/$1/$2/p`
  10.     # normally use -i to prevent overwrite
  11.     #mv -i $i `echo $i | sed -n s/$1/$2/p`
  12.   end
  13. endif
  14.