#!/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 ".."
#
set STARTWHERE=/data/globec
cd
set BEGINDIR=$STARTWHERE/objects/
cd $BEGINDIR

foreach i ( `find . -type d -print | grep "./[a-z]*"`)
  echo $i
  cd $i
#
# object.list was created by script 'findobjects' and is found in each
#     subdirectory containing a descript.html file. 
#
foreach j (`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 $STARTWHERE
