#!/bin/tcsh ## run in directory where files are to be changed set oldform="M20.0Z2.0e-02.standard" set newform="M20.0Z2.0e-02" foreach file (`ls -1 $oldform*`) #echo "compare " # 16 must match the number of characters that we want to replace +1 # first test the changes by running the script with # the real mv commented, see below set newfileb=`echo $file| cut -c23-` set newfile=$newform$newfileb echo $file "-->" $newfile ############# # uncomment the next line when the planned changes are correct ############# mv $file $newfile end