Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Dec 2023 07:41:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 275764] `uniq -D -c` gives wrong values of repeat counts
Message-ID:  <bug-275764-227-EX5T87LLVo@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-275764-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-275764-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275764

Daniel Tameling <tamelingdaniel@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tamelingdaniel@gmail.com

--- Comment #1 from Daniel Tameling <tamelingdaniel@gmail.com> ---
Created attachment 247279
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D247279&action=
=3Dedit
possible patch

The reason for this is that the code is designed for printing the repetition
counts in front of the previous line. But if -D is specified, it prints the
current line with the exception of the first duplicate. Thus, if one increa=
ses
the count before printing and not after, one gets a better result:

$ uniq -D -c animals.txt
   1 bear
   2 bear
   1 camel
   2 camel
   3 camel
   1 fish
   2 fish
   1 koala
   2 koala
   3 koala

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275764-227-EX5T87LLVo>