More portable awk script

gensub() is specific to gawk, this uses gsub() instead in order to build
on platforms that don't have gawk such as macOS.
This commit is contained in:
Philip Chimento 2016-11-12 00:36:06 -08:00
parent 9e3515f078
commit 3d05509b7c
1 changed files with 12 additions and 6 deletions

18
lig.awk
View File

@ -24,14 +24,20 @@ c=b
c!=b { print c } c!=b { print c }
/f[1-9]?$/ { /f[1-9]?$/ {
print gensub("f[1-9]?$", "ff", "g", b); out=b; gsub("f[1-9]?$", "ff", out); print out
if (c!=b) print gensub("f[1-9]?$", "ff", "g", c); if (c!=b) {
out=c; gsub("f[1-9]?$", "ff", out); print out
}
print gensub("f[1-9]?$", "fi", "g", b); out=b; gsub("f[1-9]?$", "fi", out); print out
if (c!=b) print gensub("f[1-9]?$", "fi", "g", c); if (c!=b) {
out=c; gsub("f[1-9]?$", "fi", out); print out
}
print gensub("f[1-9]?$", "fl", "g", b); out=b; gsub("f[1-9]?$", "fl", out); print out
if (c!=b) print gensub("f[1-9]?$", "fl", "g", c); if (c!=b) {
out=c; gsub("f[1-9]?$", "fl", out); print out
}
} }