-
Notifications
You must be signed in to change notification settings - Fork 23
/
lig.awk
48 lines (38 loc) · 916 Bytes
/
lig.awk
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
{print $0}
b=$0
/f[1-9]?f[1-9]?i/ {gsub("f[1-9]?f[1-9]?i", "ffi",b) }
/f[1-9]?f[1-9]?l/ {gsub("f[1-9]?f[1-9]?l", "ffl",b) }
/f[1-9]?f/ {gsub("f[1-9]?f", "ff",b); r=1}
/f[1-9]?i/ {gsub("f[1-9]?i", "fi",b); r=1}
/f[1-9]?l/ {gsub("f[1-9]?l", "fl",b); r=1}
b!=$0 {
# check alternative hyph
if (num ~ /\//) {
next;
}
print b
}
c=b
/^[1-9]?f/ { sub("^[1-9]?f", "ff", c); }
/^[1-9]?i/ { sub("^[1-9]?i", "fi", c); }
/^[1-9]?l/ { sub("^[1-9]?l", "fl", c); }
c!=b { print c }
/f[1-9]?$/ {
out=b; gsub("f[1-9]?$", "ff", out); print out
if (c!=b) {
out=c; gsub("f[1-9]?$", "ff", out); print out
}
out=b; gsub("f[1-9]?$", "fi", out); print out
if (c!=b) {
out=c; gsub("f[1-9]?$", "fi", out); print out
}
out=b; gsub("f[1-9]?$", "fl", out); print out
if (c!=b) {
out=c; gsub("f[1-9]?$", "fl", out); print out
}
}
#s/ffi/ffi/g
#s/ffl/ffl/g
#s/ff/ff/g
#s/fi/fi/g
#s/fl/fl/g