Abaixo está um script de shell Bash
.
#!/bin/bash
while read line
do
cat <<RECORD
zone "${line}" IN {
type master;
file "/etc/bind/zones/db.${line}";
allow-update { none; };allow-transfer {10.10.10.10; };
};
RECORD
done < Text-file-1
E uma versão Python
para Linux
e Windows
.
text = r"""
zone "%s" IN {
type master;
file "/etc/bind/zones/db.%s";
allow-update { none; };allow-transfer {10.10.10.10; };
};
"""
lines = [ x.strip() for x in open('Text-file-1').readlines() ]
for line in lines:
print(text % (line, line))
Saída:
zone "123.com" IN {
type master;
file "/etc/bind/zones/db.123.com";
allow-update { none; };allow-transfer {10.10.10.10; };
};
zone "234.com" IN {
type master;
file "/etc/bind/zones/db.234.com";
allow-update { none; };allow-transfer {10.10.10.10; };
};
zone "567.com" IN {
type master;
file "/etc/bind/zones/db.567.com";
allow-update { none; };allow-transfer {10.10.10.10; };
};