dbs has asked for the wisdom of the Perl Monks concerning the following question:
__INPUT__ cache,23778,0.0,0,0.0,0,0.0,0.0,0.00 cache,205,0.0,0,0.0,0,0.0,0.0,0.00 DISK-UTIL-PEAK-HIGH:,54.3,DISK-UTIL:,2.5 PROC-Name,PID,PYS-IO-RATE,READs,READ-RATE,WRITEs cache,26094,0.9,1,0.9,0,0.0,0.0,0.00 cache,16046,0.0,0,0.0,0,0.0,0.0,0.00 cache,3848,0.0,0,0.0,0,0.0,0.0,0.00 cache,23778,0.0,0,0.0,0,0.0,0.0,0.00 cache,205,0.0,0,0.0,0,0.0,0.0,0.00 DISK-UTIL-PEAK-HIGH:,54.3,DISK-UTIL:,3.4 ### last line ### __END__ use strict; use warnings; my $dstattmp = qq(/usr/local/log/disk.gpm.statlog.tmp); my $dstatlog = qq(/usr/local/log/disk.gpm.statlog.csv); open( my $DT, "+>>", $dstatlog ) || die "$dstatlog was not opened $!"; open( my $TD, "+>", $dstattmp ) || die "$dstattmp was not opened $!"; while (<$DT>) { next if ( $. == 1); if ( /cache|disk-.*/i ) { push my @tmp, split; print $TD join (",", @tmp),"\n"; } if ( /^(\D.*)(?=\d*)(?=disk-util-peak.*)/i ) print $TD "YES\n"; } ##if ( /^(cache.*)(?=\d*)(?=disk-util-peak.*)/i ) ##if ( /^(cache.*)(?=\d*)/ .. /disk-util-peak.*/igs ) } thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp look behind?
by raybies (Chaplain) on Nov 30, 2010 at 16:03 UTC | |
by dbs (Sexton) on Nov 30, 2010 at 19:24 UTC | |
by AnomalousMonk (Archbishop) on Dec 01, 2010 at 01:25 UTC | |
by raybies (Chaplain) on Dec 01, 2010 at 13:21 UTC | |
|
Re: regexp look behind?
by jffry (Hermit) on Dec 01, 2010 at 00:47 UTC |