What have you come up with so far? Post what you've got and where you're missing things or encountering errors. Nobody here will give you a ready made solution. Use the available commands for lvm in combination with grep, awk, sed. Put everything in a script and test.