Hi,
yes, we need code examples. You don't really expect us to write some script for you without having proper input, desired output and so on, do you?
Please read How (Not) To Ask A Question to give us a chance to help you by providing a properly described problem.
Regards,
svenXY