You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tde-i18n/tde-i18n-sr@Latn/sr-fc2l

92 lines
2.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/sh
#
# sr-fc2l 0.0.0
# In-place converts UTF8 Serbian Cyrillic text files to Serbian Latin.
# January 15th, 2004.
#
# Author:
# Chusslove Illich (Часлав Илић)
#
# Usage:
# sr-fc2l [FILE...]
#
# Warning:
# Once converted to Latin, files cannot be converted back to Cyrillic, as
# that direction of conversion is ambiguous. So, make backup of originals if
# Cyrillic version might still be needed.
#
# Warning:
# This script cannot properly convert `Љ', `Њ' and `Џ' in all-caps words;
# e.g. `ЉУБЉАНА' would be converted to `LjUBLjANA' instead of correct
# `LJUBLJANA'. However, these cases occur rarely.
for i in $*; do
if [ -f "$i" ]; then
sed \
-e "s/А/A/g" \
-e "s/Б/B/g" \
-e "s/В/V/g" \
-e "s/Г/G/g" \
-e "s/Д/D/g" \
-e "s/Ђ/Đ/g" \
-e "s/Е/E/g" \
-e "s/Ж/Ž/g" \
-e "s/З/Z/g" \
-e "s/И/I/g" \
-e "s/Ј/J/g" \
-e "s/К/K/g" \
-e "s/Л/L/g" \
-e "s/Љ/Lj/g" \
-e "s/М/M/g" \
-e "s/Н/N/g" \
-e "s/Њ/Nj/g" \
-e "s/О/O/g" \
-e "s/П/P/g" \
-e "s/Р/R/g" \
-e "s/С/S/g" \
-e "s/Т/T/g" \
-e "s/Ћ/Ć/g" \
-e "s/У/U/g" \
-e "s/Ф/F/g" \
-e "s/Х/H/g" \
-e "s/Ц/C/g" \
-e "s/Ч/Č/g" \
-e "s/Џ/Dž/g" \
-e "s/Ш/Š/g" \
-e "s/а/a/g" \
-e "s/б/b/g" \
-e "s/в/v/g" \
-e "s/г/g/g" \
-e "s/д/d/g" \
-e "s/ђ/đ/g" \
-e "s/е/e/g" \
-e "s/ж/ž/g" \
-e "s/з/z/g" \
-e "s/и/i/g" \
-e "s/ј/j/g" \
-e "s/к/k/g" \
-e "s/л/l/g" \
-e "s/љ/lj/g" \
-e "s/м/m/g" \
-e "s/н/n/g" \
-e "s/њ/nj/g" \
-e "s/о/o/g" \
-e "s/п/p/g" \
-e "s/р/r/g" \
-e "s/с/s/g" \
-e "s/т/t/g" \
-e "s/ћ/ć/g" \
-e "s/у/u/g" \
-e "s/ф/f/g" \
-e "s/х/h/g" \
-e "s/ц/c/g" \
-e "s/ч/č/g" \
-e "s/џ/dž/g" \
-e "s/ш/š/g" \
$i >$i.tmp && \
mv -f $i.tmp $i
else
echo "\"$i\" does not exist or is not a file!"
fi
done