2009-03-28 07:44:27 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
hxtoh()
|
|
|
|
{
|
|
|
|
flag=1
|
2009-03-29 11:06:43 +02:00
|
|
|
while read -r str; do
|
2009-03-28 07:44:27 +01:00
|
|
|
case $str in
|
|
|
|
HXCOMM*)
|
|
|
|
;;
|
|
|
|
STEXI*|ETEXI*) flag=$(($flag^1))
|
|
|
|
;;
|
|
|
|
*)
|
2009-03-29 12:50:43 +02:00
|
|
|
test $flag -eq 1 && printf "%s\n" "$str"
|
2009-03-28 07:44:27 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
hxtotexi()
|
|
|
|
{
|
|
|
|
flag=0
|
2009-03-29 11:06:43 +02:00
|
|
|
while read -r str; do
|
2009-03-28 07:44:27 +01:00
|
|
|
case "$str" in
|
|
|
|
HXCOMM*)
|
|
|
|
;;
|
|
|
|
STEXI*|ETEXI*) flag=$(($flag^1))
|
|
|
|
;;
|
|
|
|
DEFHEADING*)
|
|
|
|
echo $(expr "$str" : "DEFHEADING(\(.*\))")
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
test $flag -eq 1 && echo $str
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
"-h") hxtoh ;;
|
|
|
|
"-t") hxtotexi ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
2009-03-28 09:13:56 +01:00
|
|
|
|
|
|
|
exit 0
|