#! /bin/csh
#++++++++++++++++
#.IDENTIFICATION hipepo
#.LANGUAGE       C-shell
#.AUTHOR         Francois Ochsenbein [CDS]
#.ENVIRONMENT    
#.KEYWORDS       
#.VERSION  1.0   19-Apr-2002
#.PURPOSE        Get the Tycho Epoch Photometry
#.COMMENTS       We assume as input = Tycho Number(s)
#----------------

if ($#argv < 1) then
    echo "Usage: hipepo HIPnum [HIPnum]..."
    exit 0
endif

set dir = `dirname $0`	# Data share same root directory
set fgz = $dir/hep.gz

while ($#argv > 0)
    set hip = `echo $1 | gawk '{printf("%06d", $1)}'`
    shift
    set o   = `look $hip= $fgz.idx | cut -d= -f2`
    echo "#....In file $dir/$fgz, at offset: $o"
    tail +${o}c $fgz | gzip -cd | gawk '/^$/{p++}\
     NR==2{print "JD-2440000| Hpmag |s.e. |Tflg"} \
       {print; if (p>0) exit}'
end
