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