#!/bin/csh -f

foreach FILE (*.DAT)

   set DATA     = $FILE:r
   echo "Now working on: "$DATA
   set LABEL    = $DATA.LBL
   set NEWLBL   = $DATA.lbl
   set START    = `grep START_TIME $LABEL | sed s/1978/1992/g`
   set STOP     = `grep STOP_TIME $LABEL | sed s/1978/1992/g`
   set REC      = `grep FILE_RECORDS $LABEL`

   set F        = $START[3]
   set L        = $STOP[3]
   set R        = $REC[3]

   cp /pds/archive1/VOLUME/PV10_0003/DATA/PHOTO.DES $DATA.DES
   cp /pds/archive1/VOLUME/PV10_0003/DATA/DATA.ABS $DATA.ABS
   cp /pds/archive1/VOLUME/PV10_0003/DATA/DATA.HED $DATA.HED

   cat /pds/archive1/VOLUME/PV10_0003/DATA/LABEL_PHOTO.LBL | sed s/_rec/$R/g | sed s/_start/$F/g | sed s/_stop/$L/g | sed s/_file/$DATA/g > $NEWLBL
   /bin/mv $NEWLBL $LABEL

   mp bp=/pds/archive1/VOLUME/PV10_0003/DATA/photo.bp INF=$DATA OUT=$DATA
   unix2dos $DATA.TAB
   /bin/rm *DES *HED *ABS $FILE INF* *FMT

end

exit (0)

