c3f8900e | 09-Dec-2024 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
uniq: Fix off-by-one bug in -cD case.
When printing only duplicated lines, the first line of each set is not printed until we encounter the second. When that happens, we need to increment the repet
uniq: Fix off-by-one bug in -cD case.
When printing only duplicated lines, the first line of each set is not printed until we encounter the second. When that happens, we need to increment the repetition count between printing the first and the second line, so that if we are also printing counts, we don't print the same (pre-increment) count twice.
MFC after: 1 week PR: 275764 Reported by: Yu-Sheng Ma <s110062131@m110.nthu.edu.tw> Submitted by: Daniel Tameling <tamelingdaniel@gmail.com> (original patch) Sponsored by: Klara, Inc. Reviewed by: tamelingdaniel_gmail.com, asomers, emaste Differential Revision: https://reviews.freebsd.org/D48000
show more ...
|
11715600 | 12-Jan-2024 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have to be output. For the basic case, this means output each line as it is read unless it is identical
uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have to be output. For the basic case, this means output each line as it is read unless it is identical to the previous one. For the -d case, it means output the first instance as soon as the second is read, unless the -c option was also given. The -D and -u cases were already fine.
Add test cases for interactive use with no options and with -d.
Explicitly ignore -d when -D is also specified.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: rew, kevans Differential Revision: https://reviews.freebsd.org/D43382
show more ...
|