#!/bin/csh -f
#  NOTE:  if you have subdirectories named starting with any character
#       other than a non-CAPITAL alpha, run this script (at least) twice:
#       first with regex as is on "foreach i" line, 
#       then either [A-Z] or [0-9]
#       goal of grep is to avoid special dirs "." and ".."
# Edited 9/19/1995 rcg Changed for GLOBEC BEGINDIR.  Add second
# 	section to handle year subdirectories so don't have to rerun
#
set BEGINDIR=/data/globec/objects/globec/gb
set WHERE=`pwd`
cd $BEGINDIR

foreach i ( `find . -type d -print | grep "./[a-z]*"`)
  echo $i
  cd $i
  echo "You are at `pwd`"
###  echo "Contents of object.list is `cat object.list`"

foreach j ("`/usr/bin/cat object.list`")
		echo "**j= $j"
nawk '\
BEGIN {ok=0;print "<h1>"}\
$0 == testvar {ok=1-ok}\
ok == 1 {print $0}\
' testvar=`echo $j` descript.html > $j.info
end

cd $BEGINDIR
end
cd $WHERE

#####
set BEGINDIR=/data/globec/objects/globec/gb
set WHERE=`pwd`
cd $BEGINDIR

foreach i ( `find . -type d -print | grep "./[0-9]*"`)
  echo $i
  cd $i

foreach j ("`/usr/bin/cat object.list`")

nawk '\
BEGIN {ok=0;print "<h1>"}\
$0 == testvar {ok=1-ok}\
ok == 1 {print $0}\
' testvar=`echo $j` descript.html > $j.info
end

cd $BEGINDIR
end
cd $WHERE
