in reply to Re: To remove duplicate lines and add digits as per loop
in thread To remove duplicate lines and add digits as per loop

I don't want to change all lines , only to those lines where string is found
  • Comment on Re^2: To remove duplicate lines and add digits as per loop

Replies are listed 'Best First'.
Re^3: To remove duplicate lines and add digits as per loop
by hippo (Archbishop) on Mar 16, 2021 at 08:56 UTC

    There are so many ways to achieve that.

    • Change the pattern in the regular expression to match only those lines you want.
    • Make the substitution conditional on your pattern beforehand: /pat/ and s///
    • Don't munge any lines which don't match: next unless /pat/

    Pick one and implement it.


    🦛