To extract the required lines from a file

I have a files in a directory in this format

data
data
data
---BEGIN CERT-----
data
data
data
---END CERT -----

Now, I want to extract the lines starting from --BEGIN CERT-- and write the contents till the end of file into a new file.How can I do this for all the files in the directory using shell script.

Thanks in advance.

sed '/---BEGIN CERT-----/,/---END CERT -----/!d' infile > newfile

You can find such stuff searching the web by looking for "sed ranges".