1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
#!/bin/sh
# zgethead1:
# Get header parameters from one compressed (or not) FITS file
# By Jessica Mink, March 30, 2016
if test ! $1
then
echo zgethead1: Get header parameters from a compressed FITS file
echo " usage: zgethead1 [-v] fits.file keyword1 ... keywordn"
echo " -v: list file names as they are read"
exit
fi
# Check for verbose flag as first argument
if test $1 = "-v"
then
#echo verbose mode
vb=true
shift
else
#echo quiet mode
vb=
fi
dir=
file=
args=
while test $1
do
if test -z $file
then
isfits=`echo $1 | grep fits`
bzcomp=`echo $1 | grep \.bz2`
gzcomp=`echo $1 | grep \.gz`
zcomp=`echo $1 | grep \.Z`
#echo isfits: $isfits
#echo bzcomp: $bzcomp
#echo gzcomp: $gzcomp
#echo zcomp: $zcomp
# If .bz2 compressed file, make it file to check
if test $bzcomp
then
file=$1
if test $vb
then
echo bz2 compressed file $file
fi
# If .gz compressed file, make it file to check
elif test $gzcomp
then
file=$1
if test $vb
then
echo gzip compressed file $file
fi
# If .Z compressed file, make it file to check
elif test $zcomp
then
file=$1
if test $vb
then
echo Z-compressed file $file
fi
# If FITS file, make it file to check
elif test $isfits
then
file=$1
else
args=`echo $args $1`
fi
# Add argument to list
else
args=`echo $args $1`
fi
shift
done
if test $bzcomp
then
if test $vb
then
echo bzcat $file to gethead stdin $args
fi
bzcat $file | gethead stdin $args
elif test $gzcomp
then
if test $vb
then
echo zcat $file to gethead stdin $args
fi
zcat $file | gethead stdin $args
elif test $zcomp
then
if test $vb
then
echo zcat $file to gethead stdin $args
fi
zcat $file | gethead stdin $args
else
if test $vb
then
echo gethead $file $args
fi
gethead $file $args
fi
exit 0
# Mar 30 2016 New program based on zgethead
|