ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So it seems to work just fine for me (see output below based on the input provided by OP).
Also, the code does not care if there are more or less fields in each configuration.
Well there is obviously one problem with the data from post #9:
Code:
Device Physical Name,Device Symmetrix Name,Symmetrix ID.....
Not Visible,1234,1234567
Not Visible,3456,1234567
Not Visible,8726,1234567
Not Visible,0000,1234567
Not Visible,1234,1234567
That would be that the data presented to us does not have the field - Symmetrix ID
But I presume that is just one of the many possibilities.
I do see the code I have presented easily producing said output
So it seems to work just fine for me (see output below based on the input provided by OP).
Also, the code does not care if there are more or less fields in each configuration.
Obviously you can do with it as you will, I was just demonstrating that the output is correct.
NOTE: I altered the first lot of data to have different ending digits so I could see I was getting 2 lots of data.
Thanks for the help grail. But I don't see the code producing the output correctly. If you see my first post, the data presented starts way before 512-byte Block. All those fields are missed from the output. Post #9 was just a sample output to illustrate how I should be expecting the output. That was not real data. Real data was in post 1, and 1 complete set of information is here (next post)
I think it is going to be a lot more complex than I think. Don't you think it would be better to define all the fields first, and then look for data for all those fields in each cycle of block from "Device Physical Name" to next "Device Physical Name"?
Device Symmetrix Name : 0521 Device Serial ID : N/A Symmetrix ID : 000180100011
Attached BCV Device : N/A
Attached VDEV TGT Device : N/A
Vendor ID : EMC Product ID : SYMMETRIX Product Revision : 5773 Device WWN : 60060480000290104621533030353231 Device Emulation Type : FBA Device Defined Label Type: N/A Device Defined Label : N/A Device Sub System Id : 0x0005 Cache Partition Name : DEFAULT_PARTITION
Device is WORM Enabled : No Device is WORM Protected : No
SCSI-3 Persistent Reserve: Disabled
Dynamic Spare Invoked : No
Dynamic RDF Capability : RDF2_Capable
STAR Mode : No STAR Recovery Capability : None STAR Recovery State : NA
Device Service State : Normal
Device Status : Ready (RW) Device SA Status : Ready (RW)
Front Director Paths (2): { ---------------------------------------------------------------------- POWERPATH DIRECTOR PORT LUN --------- ---------- ---- -------- --------- PdevName Type Type Num Sts VBUS TID SYMM Host ---------------------------------------------------------------------- Not Visible N/A FA 08C:0 RW 000 00 0C8 N/A Not Visible N/A FA 09C:0 RW 000 00 0C8 N/A }
Back End Disk Director Information { Hyper Type : RAID-5 Hyper Status : Ready (RW) Disk \[Director, Interface, TID\] : \[N/A,N/A,N/A\] Disk Director Volume Number : N/A Hyper Number : N/A Mirror Number : 1 Disk Group Number : 0 Disk Group Name : DISK_GROUP_000
Hyper Type : RAID-5 Hyper Status : Ready (RW) Disk \[Director, Interface, TID\] : \[N/A,N/A,N/A\] Disk Director Volume Number : N/A Hyper Number : N/A Mirror Number : 2 Disk Group Number : 0 Disk Group Name : DISK_GROUP_000 }
RAID-5 Device Information { Number of Tracks in a Stripe : 4 Overall Ready State of RAID-5 Device : ReadyNoOtherMirror Overall WriteProtect State of RAID-5 Device : EnabledNoOtherMirror Member Number of the Failing Device : None Member Number that Invoked the Spare : None Disk Director (DA) that Owns the Spare : None Copy Direction : N/A RAID-5 Hyper Devices (3+1): { Device : 0517 (M) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 02A:D8 560 16 5755 1 RW N/A 0 286102 01C:C8 213 16 5755 2 RW N/A 0 286102 15C:C8 213 16 5755 3 RW N/A 0 286102 16A:D8 951 16 5755 4 RW N/A 0 286102 } Device : 0518 (m) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 15D:D0 364 17 5755 1 RW N/A 0 286102 16B:C0 17 17 5755 2 RW N/A 0 286102 02B:C0 17 17 5755 3 RW N/A 0 286102 01D:D0 756 17 5755 4 RW N/A 0 286102 } Device : 0523 (m) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 15B:Dc 658 17 5755 1 RW N/A 0 286102 16C:Dc 1054 17 5755 2 RW N/A 0 286102 02C:Dc 663 17 5755 3 RW N/A 0 286102 01B:Dc 1049 17 5755 4 RW N/A 0 286102 } Device : 0524 (m) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 15A:Cc 313 16 5755 1 RW N/A 0 286102 16D:Cc 310 16 5755 2 RW N/A 0 286102 02D:Cc 310 16 5755 3 RW N/A 0 286102 01A:Cc 313 16 5755 4 RW N/A 0 286102 } Device : 0521 (m) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 02B:Dd 738 17 5755 1 RW N/A 0 286102 01C:Dd 1056 17 5755 2 RW N/A 0 286102 15C:Dd 737 17 5755 3 RW N/A 0 286102 16B:Dd 1057 17 5755 4 RW N/A 0 286102 } Device : 0526 (m) { -------------------------------------------------------------- Disk DA Hyper Member Spare Disk DA :IT Vol# Num Cap(MB) Num Status Status Grp# Cap(MB) -------------------------------------------------------------- 15A:D9 611 17 5755 1 RW N/A 0 286102 16D:D9 927 17 5755 2 RW N/A 0 286102 02D:D9 608 17 5755 3 RW N/A 0 286102 01A:D9 930 17 5755 4 RW N/A 0 286102 } } }
This will make it display the only record starting with "Device Physical Name" which was your original prerequisite.
Now you have added 23 other blank lines so my separator will no longer be of use and you have included data both with and without colons (:)
so now the field delimiter is also fairly much useless.
I think you would now need a Perl expert as this is way outside my expertise (using Perl that is)
Thanks grail and everyone else for your help. I guess I would have to look for a more options to fix this issue. Actually, I have this program working but it is compiled with perl2exe and the developer has left the company with no personal email contact. I want to modify the code since it only now works with some older hardware. Need to upgrade it. So, I thought to better rewrite instead of lurking around with assembler My main aim to use perl was only to get an executable to be distributed to users, but I think even to use bash this can be achieved using SHC.
I also noticed that there are some parts were a comma also exists. There are also too many values that have newlines. I think it's better to store these things in a different format instead.. how 'bout XML? If you use XML it will be easier since there are already many read and write parsers for it.
Last edited by konsolebox; 08-22-2010 at 05:38 AM.
I also noticed that there are some parts were a comma also exists. There are also too many values that have newlines. I think it's better to store these things in a different format instead.. how 'bout XML?
Ok, I managed to get this output as xml. A sample is attached. But I must say, the original developer did one heck of a code to work with these text files
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.