#!/bin/tcsh
foreach file (100519*)
  set index = $file:e
  set segment = $file:r
  set segment = $segment:s/100519//
  @ index = $index
  if ( $index > 480 ) then
    @ new_index = $index - 480
    if ( $new_index < 10 ) then
      set new_index = 00${new_index}
    else
      if ( $new_index < 100 ) then
        set new_index = 0${new_index}
      endif
    endif 
    mv $file 100520${segment}.${new_index}
  endif
end
exit
