#!/bin/bash # cd to the directory that has the *_irac12.cat files # then run this script # it will create a .txt file for each .cat file # # We assume that we should be throwing out the first 11 lines, and the final line # in the .cat file. # Then we assume that the columns are space-separated or tab-separated. # The final .txt file has two space-separated columns (RA and Dec) # script_basename=`basename $0` function usage() { echo "Usage: $script_basename" } if [ $# -ge 1 ] ; then usage exit 1 fi for catfile in *_irac12.cat ; do txtfile=`basename $catfile .cat`.txt cat $catfile | sed -e '1,11d' | sed -e '$d' | tr -s ' \t' ' ' | cut -d\ -f3,4 > $txtfile if [ $? -ne 0 ] ; then echo "Error: Some problem converting $catfile to $txtfile" exit 1 fi done