thanks Zamial for the response.
A shell script will be fine. i just want to get an idea of how to do it. Maybe I can convert it to perl or something.

Thanks a lot
pst