
samuel_1
New User
Feb 27, 2009, 8:29 PM
Post #1 of 5
(1054 views)
|
|
Perl grammer help
|
Can't Post
|
|
have a input file has begin/end delimitters on separate lines content in between, want to capture any of data not in between begin/end patterns as well the below code works ,but fails on input not in begin..end format does this require a grammer definition of begin,content ,end ? open(IN,"<iostat.txt"); while(<IN>){ if(/^BEGIN/ .. /^END/){ add content to hash } } -- BEGIN Time: 04:43:29 PM avg-cpu: %user %nice %system %iowait %steal %idle 1.59 0.04 5.13 10.49 0.00 82.75 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 26.60 280.10 333.81 29294213 34911878 END BEGIN Time: 04:43:30 PM avg-cpu: %user %nice %system %iowait %steal %idle 9.00 0.00 88.00 3.00 0.00 0.00 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn BEGIN Time: 04:43:31 PM avg-cpu: %user %nice %system %iowait %steal %idle 7.00 0.00 91.00 2.00 0.00 0.00 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 91.00 56.00 1912.00 56 1912 END
|