I have a code like this to parse zoneinput file and remove whatever its told to remove:that contains DNS zone entries
#!/bin/bash
for; ARGwhatever.foo in[000000]
$ORIGIN "$@"whatever.foo.
do$TTL 8400
@ sed -i "/^\(something-\|other-\|\)${ARG}[[:space:]]\+IN[[:space:]]\+A/d" /etc/nsd/zones/domainIN SOA ns1.comwhatever.zonefoo. admin.whatever.foo. (
done2017101913 ; serial number
And it works great for removing lines like
21600 ; refresh
8400 ; retry
1209600 ; expire
8400 ; ttl
)
xxx IN A 000.000.000.000
something-xxx IN A 000.000.000.000
other-xxx IN A 000.000.000.000
Now I get a subdomain that I need to remove say else.xxx so entry is like:
else.xxx IN A 000.000.000.000
yyy IN A 000.000.000.001
something-yyy IN A 000.000.000.001
other-yyy IN A 000.000.000.001
else.yyy IN A 000.000.000.001
How do I tried modifying the script like thisremove for example entries that belong to xxx subdomain domain?
Output should be
sed; -iwhatever.foo "/^\[000000]
$ORIGIN whatever.foo.
$TTL 8400
@ IN SOA ns1.whatever.foo. admin.whatever.foo. (else
2017101913 ; serial number
21600 ; refresh
8400 ; retry
1209600 ; expire
8400 ; ttl
)
yyy IN A 000.\|something000.000.001
something-\|otheryyy IN A 000.000.000.001
other-\|\)${ARG}[[:space:]]\+IN[[:space:]]\+A/d"yyy /etc/nsd/zones/domain IN A 000.com000.zone000.001
else.yyy IN A 000.000.000.001
butI would like it wont work (works if copy paste this and runto be in command line but not froma bash script) also tried escaping the dot, not working.. so I can call e. Please assistg.
Edit:
delete_domain.sh xxx
There is one additional caveat - perhaps this is why it looks complicated - this script is called via the C++ script that makes it executable by non-root users. I am not sure what type of notation is [[:space]] but I suppose it was required due to the script being called by external c++ script and not directlyThanks.