#!/bin/csh -f #++++++++++++++++ #.IDENTIFICATION getstar #.LANGUAGE C_shell #.AUTHOR Francois Ochsenbein #.ENVIRONMENT CDS Catalogues Service #.KEYWORDS #.VERSION 1.0 26-Nov-1998 #.VERSION 1.1 18-Jun-2004: New files #.PURPOSE Find out the details of a star from its number #.COMMENTS The program accepts the following arguments: # Arg#1 (required): Star number #---------------- #### Check the number of arguments in the correct range. if ($#argv != 1) then echo "Usage: $0 star_number" echo " Print out the data from the Seq (running star number)" exit 1 endif #### Look in stars.dat, search for the table(s) with spectrophotometry set star = $1 ; shift set of = /tmp/$$.gc # References if (-r catalog.txt) then set cat = cat else if (-r catalog.txt.gz) then set cat = zcat else set cat = fcat endif $cat catalog.txt | gawk -v star=$star -v of=$of '\ BEGIN{print "\\par{\\bf Details for star \\#" star "}\\par\\begin{alltty}"}\ /^---[0 -]*[1-9][0-9]*-*D*$/{ if(k>0) exit;if(($NF+0)==star) k = 1}\ /^\*\*/{if(k==0) next; printf "\n\\par\\hr{}"; \ print " MHz Max(mJy) Min(mJy) Ref Remarks\\hr"; next }\ {if (k == 0) next ; print ; \ for (i=2; i<=NF; i++) { if (substr($i,1,1) != "(") continue; \ if ($i == "(") i++; r = $i; gsub(/[();, ]/, "", r); \ lis[r]= $i+0; }} \ END{for(r in lis) { if (r>0) print r > of} print "\\end{alltty}" }' #### Sort and edit the references sort -n -u $of -o $of fcat refs.dat | gawk -v of=$of 'BEGIN{\ print "\n\\hr\\par{\\bf References}\\par\\begin{alltty}" ; \ while ((getline < of) > 0) lis[$1] = 1 ; \ #print "List of References:"; for (r in lis) print r; \ }\ /^ *[1-9]/ {if($1 in lis) print }\ END{print "\\end{alltty}"}' #### Clean up rm -f $of exit 0 #######################################################################