Get list of desired LUN id from powermt output

Requirement :

You have a list of disk names from OS end and you need to get their respective LUN ids from powermt output.

This requires manual work of searching each disk name in output and then copying its respective LUN id. Typically these three lines you are interested in powermt output.

If you have list of disks to search its a tedious task.

Solution :
Get ouput of powermt command in a file

Get all disk names in one file e.g. test.txt
Run a for loop which will get LUN id of each disk described in file. In this loop we are taking each disk and searching it in above file. Then we are extracting 2 below lines from disk name (since 2nd line below disk name contains LUN id). And then extracting LUN id from it with some data filtering.

You will be presented with the list of LUN ids for respective disks in the test.txt file! You can even echo disk name before LUN id by inserting echo $i just above cat command in above code.

Vice versa:

Get disk names by giving LUN ids in text.txt file. Its same logic, only difference is we will be extracting above 2 lines rather than below ones. Rest all procedure remains same.

Any thoughts?