This pattern is repeated a lot of times, once for each volume in my storage array.Symmetrix ID: Device Physical Name : \\.\PHYSICALDRIVE1 Device Symmetrix Name : 0062 (VCM) Device Serial ID : 6000062081 Symmetrix ID : 002020202220 Attached BCV Device : N/A Attached VDEV TGT Device : N/A Vendor ID : EMC Product ID : SYMMETRIX Product Revision : 5772 Device WWN : 222222222222222222 Device Emulation Type : FBA Device Defined Label Type: N/A Device Defined Label : N/A Device Sub System Id : 0x0001 Cache Partition Name : DEFAULT_PARTITION Device Block Size : 512 Device Capacity { Cylinders : 6 Tracks : 90 512-byte Blocks : 11520 MegaBytes : 6 KiloBytes : 5760 } Device Configuration : 2-Way Mir (Non-Exclusive Access) Device is WORM Enabled : No Device is WORM Protected : No SCSI-3 Persistent Reserve: Disabled Dynamic Spare Invoked : No Dynamic RDF Capability : None STAR Mode : No STAR Recovery Capability : None STAR Recovery State : NA Device Service State : Normal
That sort of thing. But that seems ... well, just rather inelegant really, when I'm pretty sure I can do multi-line regexps. I just can't quite get my head around how to turn at multi-line RE into 'something useful' for a 'foreach' loop, with multiple values.my $symm_id; foreach ( `symdev list -v` ) { if ( m/Symmetrix ID/ ) { $symm_id = ( m/Symmetrix ID\s+:\s+(\d+)/ ); } }
Well, approximately - that's not quite what I want to do, as the greedy matches will eat the intervening chunks of the command output. But essentially, I want to do that 'per record'. Given the output of this particular command generates around 400Mb, I may end up dumping it to a file first.my $text_to_parse = `symdev list -v`; my ( $dev, $sym, $config, $SCSI3 ) = ( $text_to_parse =~ m/Device Symmetrix Name\s+\:\s+([A-F0-9]+).*S +ymmetrix ID\s+\:\s+(\d+).*Device Capacity.*Cylinders\s+\:\s+(\d+).*SC +SI-3 Persistent Reserve\s+\:\s+(\w+)/m ); print "$dev, $sym, $config, $SCSI3\n";
In reply to Multiple line records from a command string by Preceptor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |