mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-11-18 19:09:31 +00:00
ddb82cb2e0
Maybe someday I'll become adept at using cvs...
23 lines
560 B
Plaintext
23 lines
560 B
Plaintext
# form.gen - generate form letters
|
|
# input: prototype file letter.text; data lines
|
|
# output: one form letter per data line
|
|
|
|
BEGIN {
|
|
oldfs = FS;
|
|
FS = ":"
|
|
while (getline <"letter.text" > 0) # read form letter
|
|
form[++n] = $0
|
|
FS = oldfs;
|
|
# get country name from command-line argument
|
|
pat = ARGV[1]; ARGV[1] = "-"
|
|
}
|
|
|
|
$1 ~ pat { for (i = 1; i <= n; i++) { # read data line for country
|
|
temp = form[i]
|
|
for (j = 1; j <= 3; j++)
|
|
gsub("#" j, $j, temp)
|
|
gsub("#4", $2/$3, temp)
|
|
print temp
|
|
}
|
|
}
|