in reply to To remove duplicate lines and add digits as per loop
You have interspersed your code with prose making it more difficult to download and analyse. Do not do that. Wrap your prose in <p> tags and your data and code in <code> tags instead, please.
Here is a one-liner which does what you want. Add -i to edit in-place (see perlrun)
perl -lpe '$s{$_}++; s/;$/_$s{$_};/' foo.txt
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To remove duplicate lines and add digits as per loop
by suvendra123 (Initiate) on Mar 16, 2021 at 02:13 UTC | |
by hippo (Archbishop) on Mar 16, 2021 at 08:56 UTC |