exsnafu has asked for the wisdom of the Perl Monks concerning the following question:
now, the code I've written thus far:Pseudo name=hdiskpower97 Symmetrix ID=000187751303 Logical device ID=0380 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ====================================================================== +======== ---------------- Host --------------- - Stor - -- I/O Path - -- S +tats --- ### HW Path I/O Paths Interf. Mode State Q-IO +s Errors ====================================================================== +======== 0 fscsi0 hdisk100 FA 10cA active alive +0 0 2 fscsi2 hdisk254 FA 7cA active alive +0 0 Pseudo name=hdiskpower90 Symmetrix ID=000187751303 Logical device ID=0381 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ====================================================================== +======== ---------------- Host --------------- - Stor - -- I/O Path - -- S +tats --- ### HW Path I/O Paths Interf. Mode State Q-IO +s Errors ====================================================================== +======== 2 fscsi2 hdisk247 FA 7cA active alive +0 0 0 fscsi0 hdisk93 FA 10cA active alive +0 0
ok, so i'd expect it to fill $1 and $2 up with my groupings and print out just those two fields but $2 is unitialized and if I just print $1 it seems to be going back and forth between my groupings.. clearly I'm missing something basic about how this works. any advice?#!/usr/bin/perl -w use strict; use warnings; my @filelist = <usc*.devs>; foreach my $file (@filelist) { open(FH,$file) or die "cant open $file: $!"; while(<FH>) { if(/^.*Pseudo.*?\=(.*?$)/ .. /^.*Logical.*?\=(.{4})/sg) { print "$1,$2\n; } } close(FH); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: help printing items across multiple lines
by mr_mischief (Monsignor) on Jun 04, 2008 at 17:47 UTC | |
by exsnafu (Initiate) on Jun 04, 2008 at 20:02 UTC | |
|
Re: help printing items across multiple lines
by toolic (Bishop) on Jun 04, 2008 at 20:54 UTC | |
|
Re: help printing items across multiple lines
by GrandFather (Saint) on Jun 04, 2008 at 21:14 UTC | |
|
Re: help printing items across multiple lines - one regex, one hash, two keys
by Narveson (Chaplain) on Jun 04, 2008 at 22:14 UTC | |
by exsnafu (Initiate) on Jun 05, 2008 at 17:02 UTC |