Rename the PHT Data Files from Your ISO Data CD
# This converts the names of PHT data files from CDROM to the format
# required by PIA. It should be called at lesat one directory above
# where individual data files are. For example,
# cd ..../products/p0002813 !cd to the directory just above data files
# pht_rename !to rename FITS data files in all subdirectories
#
# J. Li/IPAC
# Last revision: June 1996
#
#!/bin/csh
if ($#argv != 0) goto usage
echo This might take a minute...
foreach f (`find . -type f -name \*.fit -print`)
set dirname = `dirname $f`
set lastdir = `basename $dirname`
set filename = `basename $f .fit`
if ( "$lastdir" == "others" ) then
set filename = $dirname/`echo $filename | tr '[a-z]' '[A-Z]'`.FITS
else
set tmpdir = `echo $dirname | awk '$0 ~ /others/ {print $0}'`
if ("$tmpdir" != "") then
set updir = `dirname $dirname`
set filename = $lastdir$filename.fits
set filename = $updir/`echo $filename | tr '[a-z]' '[A-Z]'`
else
set filename = $dirname/`echo $filename | tr '[a-z]' '[A-Z]'`$lastdir.FITS
endif
endif
mv $f $filename
echo $filename
end
exit 0
usage:
echo "Usage: pht_rename"
echo " Caution: this script renames Phot datafiles to conform to PIA"
echo " naming convention."
exit 1
Last update: May 1997