My test file test.txt is given below:

```
destination mailerr  { file("/var/log/mail.err" fsync(yes)); };
log { source(src); filter(f_mailerr);  destination(mailerr); };

#
# and also all in one file:
#
destination mail { file("/var/log/mail"); };
log { source(src); filter(f_mail); destination(mail); };

destination mailwarn { file("/var/log/mail.warn"); };
log 
{ 
#source(src); 
filter(f_mailwarn); destination(mailwarn); };

```

I want to remove below lines using shell script

```
log 
{ 
#source(src); 
filter(f_mailwarn); destination(mailwarn); };

```

This lines might be comes different structure like

```
log{ source(src); filter(f_mailwarn); destination(mailwarn); };
                          (or)
log
{ 
source(src); 
filter(f_mailwarn); 
destination(mailwarn); 
};
                           (or)
log
{ source(src); filter(f_mailwarn); destination(mailwarn); };
                           (or)
#   log { source(src); filter(f_mailwarn); destination(mailwarn); };
};

```

These are the possibilities. I am using sed command:

```
sed '/log/{:a;/destination(mailwarn);.*}/d;N;ba}' test.txt

```

But it'll remove all line because first line it self "log" comes. So many of "log" comes in this file so how to remove the particular lines using shell script.