forked from barumau/pandunia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlista_lekse.sh
97 lines (80 loc) · 2.75 KB
/
lista_lekse.sh
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
92
93
94
95
96
fata_liste_x_pandunia() {
#pandunia unordi
cat pandunia-lekse.csv | awk -F "|" "{print \$1 \" - \" \$$1 \" \"}" > $2/pandunia-$2.md
#morta unordi linye
sed -i '1d' $2/pandunia-$2.md
# alfebete
cat temp/abace.txt $2/pandunia-$2.md | LC_ALL=C sort -f > temp/temp.txt
sed 's/.00/##/g' temp/temp.txt > $2/pandunia-$2.md
#Add header
sed -i "1s/^/# pandunia-$2\n/" $2/pandunia-$2.md
#Delete empty translations
sed -i '/-...$/d' $2/pandunia-$2.md
}
fata_liste_pandunia_x() {
#ali bax unordi
cat pandunia-lekse.csv | awk -F "|" "{print \$$1 \" - \" \$1 \" \"}" > $2/$2-pandunia.md
#morta unordi linye
sed -i '1d' $2/$2-pandunia.md
# alfobeta
cat temp/abace.txt $2/$2-pandunia.md | LC_ALL=C sort -f > temp/temp.txt
sed 's/.00/##/g' temp/temp.txt > $2/$2-pandunia.md
#Add header
sed -i "1s/^/# $2-pandunia\n/" $2/$2-pandunia.md
#Delete empty translations
sed -i '/^.-/d' $2/$2-pandunia.md
}
fata_leksasli_liste() {
# cat pandunia-lekse.csv | awk -F "|" "{print \$$1 \$1 \$4 }" > $2/leksaslia.md
cat pandunia-lekse.csv | awk -F "|" "{print \"|\" \$$1 \"|\" \$1 \"|\" \$4 \"|\"}" > $2/leksaslia.md
#morta unordi linye
sed -i '1d' $2/leksaslia.md
#Sort
LC_ALL=C sort -f $2/leksaslia.md --output $2/leksaslia.md
#Add header row
sed -i "1s/^/|$2 | pandunia | leksasle |\n/" $2/leksaslia.md
#Add header
sed -i "1s/^/# $2-pandunia sa leksasle\n/" $2/leksaslia.md
#Delete empty translations
sed -i '/||/d' $2/leksaslia.md
}
fata_liste() {
fata_liste_x_pandunia $1 $2
fata_liste_pandunia_x $1 $2
fata_leksasli_liste $1 $2
}
fata_lekse_asle() {
cat pandunia-lekse.tsv | cut -f 1,4 > temp/lekse.txt
sed -i '1d' temp/lekse.txt
sed -i 's/\t/ ← /g' temp/lekse.txt
awk ' { FS=" ← "; OFS=" ← "; t = $1; $1 = $2; $2 = t; print; } ' temp/lekse.txt > temp/temp.txt
#Delete empty etymologies
sed -i '/\ ← $/d' temp/temp.txt
cat temp/abace.txt temp/temp.txt | sed 's/\t/@/g' | LC_ALL=C sort -f | sed 's/.00/##/g' | sed 's/@/ /g'> temp/lekse.txt
#Add two spaces to line-ends
sed 's/$/ /' -i temp/lekse.txt
cat pandunia/loge_asle_supre.md temp/lekse.txt > pandunia/loge_asle.md
}
#dos2unix pandunia-lekse.csv
# engli e pandunia
fata_liste 5 engli
fata_leksasli_liste 5 engli
#Tiddly dictionary
cp engli/pandunia-engli.md temp/temp.txt
sed 's/_//g' -i temp/temp.txt
cat temp/tiddly_1.html temp/temp.txt temp/tiddly_3.html > engli/tiddly.html
# esperanti e pandunia
fata_liste 20 esperanti
# suomi e pandunia
fata_liste 21 suomi
# polski e pandunia
fata_liste 22 polski
# cini e pandunia
fata_liste 11 cini
# rusi e pandunia
fata_liste 9 rusi
# fransi e pandunia
fata_liste 6 fransi
# espani e pandunia
fata_liste 7 espani
#fata_lekse_asle