noprompt
1 Nickel

Extract a block of text with sed/awk/grep from symdev list -v output?

For some offline discovery, I grab symdev list -v output. I want to extract a block of all information for a single device. I did quite a bit of searching and some of the following looked promising but I've not been able to translate them into a solution:
http://www.bing.com/search?q=exxtract+block+of+text+from+text+file++sed+aawk+grep&src=IE-SearchBox&F...

So for a device, say 00DA, I'd like to run a query against a saved symdev -sid XXX list -v output (saved in a symdev-list-v.txt file) that captures all information for just that one device and no other device that I can output to another file or use within a script. The relevant information is that all devices start with the following 3 lines (Device Physicaal Name, then a space, then Device Symmetrix Name):

 

Device Physical Name : Not Visible (or some assigned Physical name)

Device Symmetrix Name : 00DA

The end of a block can vary, so the best end point seems to be to find the next block, which will again be of the same format:

Device Physical Name : Not Visible (or some assigned Physical name)

Device Symmetrix Name : 00DB

Then finally to just lop off the last 2 lines off from the 00DB device to be left with all information from the 00DA device. Hopefully this is not too tricky and would greatly appreciate if a Unix/regex expert can help me out!?

Thanks,
Roy.

Labels (2)
0 Kudos