#!/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 f = catalog.txt set cat = cat if (-r $f.Z) set cat = zcat if (-r $f.gz) set cat = gzcat set of = /tmp/$$.gc # References $cat $f | gawk -v star=$star -v of=$of '\ BEGIN{ print "\\par{\\bf Details for star:",star "}\\par\\begin{alltty}" } \ /^-----* *[1-9]/{ if(k>0) exit;if($2 == 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}" }' #### Add the references set f = refs.dat set cat = cat if (-r $f.Z) set cat = zcat if (-r $f.gz) set cat = gzcat sort -n -u $of -o $of $cat $f | gawk -v of=$of 'BEGIN{\ print "\n\\hr\\par{\\bf List of 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 #######################################################################