#!/bin/sh # fundisp keyfile | funcones [datafile] [radius] set -x # first argument: input file name if [ x$1 = x ]; then echo "usage: $0 file < keyfile" exit 1 else FILE=$1 OBASE=`basename $FILE | awk -F. '{x=NF-1;print $x}'` shift fi # second argument: input file's RA column name and units if [ x$1 = x ]; then RACOL="RA:h" else RACOL=$1 shift fi # third argument: input file's DEC column name and units if [ x$1 = x ]; then DECCOL="DEC:d" else DECCOL=$1 shift fi # fourth optional arg: radius if [ x$1 = x ]; then RAD=".1d" else RAD=$1 fi # make sure input file is available if [ ! -r $FILE ]; then echo "ERROR: $FILE not found" exit 1 fi # read column names read COLS # skip dashes read DASHES i=1 # read each line into its column names while read $COLS do # output filename just has a number id OFILE=${OBASE}_${i}.mat # display relationship between id and ra, dec echo "${OFILE} ${RA} ${DEC} ${SEP}" # specific funcone command line goes here (add unit specifiers, etc.) funcone -r ${RACOL} -d ${DECCOL} ${FILE}'[1]' ${OFILE} ${RA}d ${DEC} ${RAD} # exit i=`echo "$i+1" | bc` done