Thanks Yogesh
I have almost 3000 blocks in this file. I have another list file which contain list of zone names e.g. pqr,abc,bzs.
I am using awk to run your sed command for each zone in list file
I think it's possible to optimize above coding. It's possible to remove system("mv named.backup.test named.backup") with some change.
Could you please help me for it
One concern, i am not sure what will be content of all your blah blah. If they will cover all the content, maybe will cause some conflict with the code. Anyway, please try it, if any problem, please post it. Maybe all of us here can help you to solve it.
code:
sed '/^$/d' a > a.tmp
nawk 'BEGIN{
FS="\r"
RS="}\r"
a="abc"
b="pqr"
}
{
if ($1=="" && index($2,a)==0 && index($2,b)==0)
print $0
if ($1!="" && index($1,a)==0 && index($1,b)==0)
print $0
}' a.tmp
rm a.tmp