Shell script for text extraction from a file

Hi All,

I am new to Shell Scripting.

I have a file consisting of XML messages.Each message is associated with a timestamp value(it is not a xml field).I need to extract\copy all messages in a particular time interval and put in another new file using Shell Scripting. My XML looks like this.

2008-01-27 00:05:00 (2008-01-27 00:05:00.055000000Z): message={Data="<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header>
....
....
</Header>
<Body>
....
....
</Body>
</Envelope>"
2008-01-27 00:05:12 (2008-01-27 00:05:12.055000000Z): message={Data="<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header>
....
....
</Header>
<Body>
....
....
</Body>
</Envelope>"

Any code/example is welcome.

Thanks,
Vignesh.

cat messages.Each | grep message | grep "time_stamp" > file_messages

ex: cat messages.Each | grep "message" | grep "00:05"

Does this copy only the line containing the timestamp or the entire message content corresponding to each message?

the lines with the messages and a particular timestamp