uniq

Denis Vlasenko vda.linux at googlemail.com
Thu May 10 13:33:09 PDT 2007


On Thursday 10 May 2007 16:30, Giuseppe Ciotta wrote:
> ~/busybox-1.5.0$ yes | ./busybox uniq -> no output
> 
> ~$ yes |  uniq
> y
> 
> - busybox uniq never prints a line since it waits for the next different
> line, which will never be read in this case as input lines are all equals.
> - gnu uniq prints a line as it reads it, discarding following lines.
> 
> Is there a reason for this discrepancy between gnu uniq and busybox one?

uniq -c needs to know the number of dups before it prints the line.

busybox has unified code for cases with and without -c, thus
it has to print the line only when all dups were already seen.
--
vda


More information about the busybox mailing list