in reply to Removing matched pattern except the first pattern
An alternative approach is to match the lines you want to see:
use strict; use warnings; while(<DATA>){ print if /^\s+\d\s+\d\s+/; } __DATA__ procs -----------memory---------- ---swap-- -----io---- --system-- --- +--cpu----- r b swpd free buff cache si so bi bo in cs us s +y id wa st 0 0 0 50101200 234628 9636240 0 0 0 34 10782 6802 + 1 1 98 0 0 1 0 0 50102044 234628 9636276 0 0 0 96 8630 6980 +1 1 98 0 0 1 0 0 50113020 234628 9626112 0 0 0 3092 13393 10324 + 3 1 96 0 0 1 0 0 50111244 234628 9628188 0 0 0 1540 10106 8874 + 2 1 97 0 0 0 0 0 50111256 234628 9628228 0 0 0 0 8674 6961 +1 1 98 0 0 0 0 0 50109884 234628 9628228 0 0 0 280 11290 7593 + 1 1 97 0 0 0 0 0 50110672 234628 9628264 0 0 0 16 8886 7301 +1 1 98 0 0 1 0 0 50110708 234628 9628268 0 0 0 40 11285 6833 + 1 1 98 0 0
|
|---|