#!/bin/zsh if [ ! -n "$1" ]; then echo "process " exit -1 else file=$1 fi ofile="$file.processed" if [ ! -f $ofile ]; then echo "Creating processed version of $file..." bzcat $file | ruby ../rb/xmlprocess.rb | bzip2 > $ofile else echo "$ofile already exists" fi ifile="$file.index.txt" if [ ! -f $ifile ]; then echo "Creating index..." ruby ../rb/index.rb $ofile > $ifile else echo "$ifile already exists" fi sfile="$file.locate.db" if [ ! -f $sfile ]; then echo "Creating locate index..." cat $ifile | LC_ALL=C /usr/libexec/locate.mklocatedb > $sfile else echo "$sfile already exists" fi spfile="$file.locate.prefixdb" if [ ! -f $spfile ]; then echo "Creating locate prefix index..." ../c/lsearcher -f $sfile -c $spfile -n else echo "$spfile already exists" fi bfile="$file.blocks.db" if [ ! -f $bfile ]; then echo "Creating block index" ../c/bzipreader -f $ofile -l | awk '{print $2;}' | ../c/blocks $bfile else echo "$bfile already exists" fi