blob: 422124f52235fe46cb3ee04758d27c8b25be1330 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/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
|