in reply to Re: Removing matched pattern except the first pattern
in thread Removing matched pattern except the first pattern

2teez: It is deleting all the lines with procs -----------memory---------- ---swap-- -----io---- --system-- but leaving all the lines with r b swpd free buff cache si so bi bo in I need to keep the first two lines procs -----------memory---------- ---swap-- -----io---- --system-- --- +--cpu----- r b swpd free buff cache si so bi bo in cs us s +y id wa st and delete any further occurence of these lines

  • Comment on Re^2: Removing matched pattern except the first pattern

Replies are listed 'Best First'.
Re^3: Removing matched pattern except the first pattern
by 2teez (Vicar) on May 29, 2013 at 04:35 UTC

    rahulruns,
    It is deleting all the lines with procs...

    WHICH?, your actual code or the codes I presented in Re: Removing matched pattern except the first pattern.
    Maybe, you need to check your data and how you implemented the code given.
    The output of the code presented perviously is:

    Please, try it yourself TIY.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me