Command line: add text wrapper around words

I am trying to build a sinkhole for BIND. I created a master zone file for malicious domains and created a separate conf file, but I am stuck.

I have a list of known bd domains that is updated nightly. The file simply contains the list of domains, one on each line:

Bad.com
Bad2.com
Bad3.com
...
EOF

I need to add a zone wrapper around each domain, so they look like this:
zone "bad.com" IN { type master; file "/var/named/bad/malware.zone";};
zone "bad2.com" IN { type master; file "/var/named/bad/malware.zone";};
zone "bad3.com" IN { type master; file "/var/named/bad/malware.zone";};

I thought I could use sed to do this, but I can't figure out how to insert in the middle of a line only at the beggining or end.

Any help would be greatly appreciated.

We are not clear little bit.
per my understanding..

awk '{print "zone "$0 "IN { type master; file /var/named/bad/malware.zone}"}' test.txt 
1 Like
sed 's/^/zone "/;s:$:" IN { type master; file "/var/named/bad/malware.zone";};:' file
1 Like

I love both answers, thank you! The only problem with using the awk command above is that it does not retain the quotation marks when you pipe it to a file. I added a couple of escapes and it worked great!

Again, I appreciate the help.

a ksh:

while read d;do echo 'zone "'${d}'" IN { type master; file "/var/named/bad/malware.zone";};';done<infile