in reply to Summing up duplicate lines
I assume you just want to "collapse" consecutive lines and you don't care about "repetitions" which are separated.
Hence no %seen hash is needed, just remember the $last line aka array and compare it to the $current one.
If the $current one fits your criteria add it to $last, if it doesn't print $last and make $last=$current for the next iteration.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Summing up duplicate lines
by LanX (Saint) on May 09, 2024 at 12:52 UTC | |
|
Re^2: Summing up duplicate lines
by oko1 (Deacon) on May 09, 2024 at 22:06 UTC | |
by LanX (Saint) on May 10, 2024 at 12:53 UTC |