set mi1 = `ls mi1*Z` foreach if ( $mi1 ) set of = `echo $if | awk '{gsub("mi1","mit")} {print $0}'` echo $if $of mv $if $of end