#!/bin/csh
# Change the URLs contained in $1 and write new file

# RM_CMD - command to be used for removing files and directories
if (-e /usr/bin/rm) then
   set RM_CMD = /usr/bin/rm
else
   if (-e /bin/rm) then
      set RM_CMD = /bin/rm
   else
      set RM_CMD = rm
   endif
endif

# Create new file with modified string
sed -e 's%/plant_science/UNIX%/plant_science/psgendb%g'  $1 > $$.temp

# If new file is different from old file, overwrite old file with new file
diff $1 $$.temp > $$.diff
if !(-z $$.diff) then
   mv $$.temp $1
   chmod a+r $1
endif
$RM_CMD -f $$.*
