Removing specific lines

Hi
I have a .conf file having many location tags like

<Location /main>
AuthName main
AuthUserFile /ppt/gaea/passwd_main
Require user admin
</Location>
......
...
<Location /wonder>
AuthName gaea
AuthUserFile /ppt/gaea/passwd_gaea
Require user admin
</Location>
.

now I want to remove a tag having attribute "main" through shell script .Please help me how do i remove this

Thanks

With awk you can do something like:

awk '/^<Location \/main>/{f=1;next}
f && /^<Location /{f=0}
!f' file

Regards

Thank u franklin .its working :). But it will print on the console .what i need is directly changed on the file

Redirect the output to a temporary file and replace the original file with it.

Regards