#! /bin/csh -f
set scname=$0
if($#argv != 0) then
   echo Usage: $scname:t 'No inputs'
   exit(1)
endif
#A fairly direct script to carry over information to classify_j1.out 
#and flux values from sampling_flux.out. I also changed the alt_classify*csh 
#files so that the fluxes are grabbed from sampling_flux.out

set src_run = "/data1/grad56/jjadams/diagnose/scripts/COSMOS_alt_cntprt.csh"
set fl_size = `wc -l < classify_j1.out`
set ID_in = `cat classify_j1.out | awk '{split($0,a," "); print a[8]}'`
set cntID_in = `cat classify_j1.out | awk '{split($0,a," "); print a[11]}'`
rm -f test.out junk_hold.txt
set cnt_o = 0
while ($cnt_o < $fl_size)
   @ cnt_o = $cnt_o + 1
   if ($ID_in[$cnt_o] == "-1") then
      cat classify_j1.out | awk 'NR==var1{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16}' var1=$cnt_o >> junk_hold.txt
   else
      echo "$src_run $cnt_o $cntID_in[$cnt_o]" | /bin/csh -f >> junk_hold.txt
   endif
end
paste junk_hold.txt classify_j1.out | awk '{print $1,$2,$3,$4,$5,$6,$7,$24,$9,$10,$11,$12,$13,$14,$15,$16,$33,$34}' >> test.out
exit(0)
