nsbin/old/ae_to_latex

48 lines
1.2 KiB
Text
Raw Normal View History

2006-07-20 07:54:37 +00:00
# Date: 15th of March 2k+1
# Last Changed: 24th of February 2k+4
# Author: Nico Schottelius <Nico AT Schottelius DOT Org>
# Description: This script searches for the following strings
# and will substitute them with the right German Characters for Latex
#
# \"a = <20>
# \"u = <20>
# \"o = <20>
# \"A = <20>
# \"O_ = <20>
# \"U = <20>
# \ss{} = <20> (not _ss_ like it was earlier)
#
if [ $# -lt 1 ]; then
echo `basename $0`': file(s)'
echo 'Hey, hey guy, what to convert ?'
exit 1
fi
for mfile in $@; do
if [ ! -f "$mfile" ]; then
echo "Keine Datei namens $mfile gefunden. Skip."
break
fi
# something other programs do not use
G_STR=".`date +%s%M%U`-`basename $0`-`basename $mfile`-$$"
echo "Using $G_STR to convert $mfile ..."
cat "$mfile" | sed -e 's/<2F>/\\"a/g' -e 's/<2F>/\\"u/g' -e 's/<2F>/\\"o/g' \
-e 's/_ae_/\\"a/g' -e 's/_ue_/\\"u/g' -e 's/_oe_/\\"o/g' \
-e 's/_Ae_/\\"A/g' -e 's/_Ue_/\\"U/g' -e 's/_Oe_/\\"O/g' \
-e 's/_sz_/\ss{}/g' -e 's/<2F>/\\"a/g' -e 's/<2F>/\\"u/g' -e 's/<2F>/\\"o/g' \
-e 's/<2F>/\\"A/g' -e 's/<2F>/\\"U/g' -e 's/<2F>/\\"O/g' -e 's/<2F>/\\ss{}/g'>"$G_STR"
if [ $? = 0 ]; then
mv "$G_STR" "$mfile"
else
echo "Replacing failed, don't replace original."
fi
done