license_escape() { env ARACHNOPRESS_COPYRIGHT_HOLDER="$copyright_holder" \ awk -v year="$copyright_year" ' function replace(s, needle, value, p, out) { out = "" while (p = index(s, needle)) { out = out substr(s, 1, p - 1) value s = substr(s, p + length(needle)) } return out s } BEGIN { holder = ENVIRON["ARACHNOPRESS_COPYRIGHT_HOLDER"] } { line = replace($0, "", year) line = replace(line, "", holder) gsub(/&/, "\\&", line) gsub(//, "\\>", line) print line } ' "$license_file" }