#!/bin/sh
#  This shell is generated by ExplorDataShellTools / ExplorGenerShellIndexPath

echo "---- Executing sh /Users/jacquesducloy/Documents/WicriRoot/Wicri/Manuel/explor/Rabelais.storage/RabelaisV1/bin/HalCorpusIndexHalKwd.i.sh" 
export LC_ALL=C 

if test -e  $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.hcs
then
echo "----- Executing -rf  $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.*"
rm -rf  $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.*
fi
HfdCat $EXPLOR_AREA/Data/Hal/Corpus/biblio.hfd  \
     | SgmlSelect -s record/TEI/teiHeader/profileDesc/textClass/hal:keywords/keyword/term# -p @S -p @1  \
     | sort -u  \
     | IndexFastBuildRec  \
     | HfdBuild -h $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i 

IndexBuildHid -h  $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i -p record/TEI/teiHeader/profileDesc/textClass/hal:keywords/keyword/term# -e kw  

HfdCat $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.hfd   \
     | SgmlFast -c l  \
     |  SxmlSelect -g idx/f/1 -p @g1 -p @2  \
     | sort -rn  \
     | SgmlFast -c 1  \
     | head -500 > $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.sort  

 echo "==== " Hal, step Corpus, index HalKwd.i done
 HfdCat $EXPLOR_AREA/Data/Hal/Corpus/HalKwd.i.hfd | wc 
