bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-18 Thread Bernhard Voelker
On 11/18/20 12:25 PM, Chris Elvidge wrote: > You could write your own function to do it. E.g. > > unique() { > [ "$1" ] || { echo "Needs a readable file to test" && return 1; } > [ -r "$1" ] || { echo "Needs a readable file to test" && return 1; } > R=""; N=0 > while IFS=$'\n' read L; do > [ "$L"

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-18 Thread Chris Elvidge
On 17/11/2020 01:32 pm, Brian J. Murrell wrote: It would be a useful enhancement to uniq to replace all lines considered non-uniq (i.e. those that would be removed from the output) with a message about how many times the previous line was repeated. I.e. $ cat < You could write your own

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-17 Thread Brian J. Murrell
On Tue, 2020-11-17 at 14:10 -0800, Paul Eggert wrote: > On 11/17/20 5:32 AM, Brian J. Murrell wrote: > > [previous line repeated 4 times] > > uniq -c already does something like that, though it outputs "5" > instead of "4". Right. I had considered that. Something like: $ cat /tmp/in | uniq

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-17 Thread Paul Eggert
On 11/17/20 5:32 AM, Brian J. Murrell wrote: > [previous line repeated 4 times] uniq -c already does something like that, though it outputs "5" instead of "4". Not sure it's worth gussying up 'uniq' to provide exactly the functionality requested, as output reformatting is easy enough to do

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-17 Thread Brian J. Murrell
On Tue, 2020-11-17 at 08:05 -0700, Assaf Gordon wrote: > > Hello, Hi, > uniq supports the "--group" option, which adds a blank line after > each > group of identical lines - this can be used down-stream to process > groups in any way you want. But there is no way to have it remove the repeated

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-17 Thread Assaf Gordon
tag 44704 notabug severity 44704 wishlist stop Hello, On 2020-11-17 6:32 a.m., Brian J. Murrell wrote: It would be a useful enhancement to uniq to replace all lines considered non-uniq (i.e. those that would be removed from the output) with a message about how many times the previous line was

bug#44704: uniq: replace repeated lines with a message about how many repeated lines

2020-11-17 Thread Brian J. Murrell
It would be a useful enhancement to uniq to replace all lines considered non-uniq (i.e. those that would be removed from the output) with a message about how many times the previous line was repeated. I.e. $ cat < signature.asc Description: This is a digitally signed message part