Subject: uniq: replace repeated lines with a message about how many repeated lines

From: "Brian J. Murrell" <[email-masked]>
Date: Tue, 17 Nov 2020 08:32:36 -0500

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 <<EOF | uniq --replace-with-message '[previous line repeated %d times]'
first line
second line
repeated line
repeated line
repeated line
repeated line
repeated line
third line
EOF
first line
second line
repeated line
[previous line repeated 4 times]
third
line

Cheers,
b.