#! /bin/csh -f
# Last edited on 2004-01-30 07:38:27 by stolfi

# Extracts words from the raw (hexbytes) Quran, for checking purposes.
# Converts them to JSAR.

cat \
  | egrep -v -e '^ *([\#]|$)' \
  | sed \
       -e 's:@chapter{\(.*\)}{\([^{}]*\)}{\([^{}]*\)} *:\1. \3 = :g' \
       -e 's:@verse{\(.*\)}{\(.*\)} *:\1.\2. :g' \
       -e '/@fix/d' \
       -e 's:^@= *$:=:g' \
  | iso-8859-6-to-hexbytes \
  | hexbytes-to-jsar \
  | sed -e 's: *[=]: รท =:g' \
  | tr '_ ' '\012\012' \
  | egrep -v '^ *$'