uniq -c formatting

Robert P. J. Day rpjday at mindspring.com
Tue Jul 18 09:55:34 UTC 2006


On Tue, 18 Jul 2006, Eric Spakman wrote:

> Hi list,
>
> Somewhere between busybox-1.0 and 1.2 the formatting of uniq -c
> changed. Previously some leading spaces where present but with 1.2
> this is no longer the case. The new behaviour brakes some formatting
> in the output of scripts (for example the shorewall program,
> www.shorewall.net).
>
> Simple test case.
> file "test" contents:
> test1
> test2
>
> busybox-1.0
> #cat test | uniq -c
>         1 test1
>         1 test2
>
> busybox-1.2
> #cat test | uniq -c
> 1 test1
> 1 test2
>
> I'm not sure what the desired susv3 behaviour should be, but a
> "full" version of uniq has the busybox-1.0 behaviour.

i'm not sure that that aesthetic change should be blamed for any
scripts breaking.  the man page for uniq reads:

"A field is a run of whitespace, then non-whitespace characters."

leading whitespace should generally be regarded as entirely optional.
if a script breaks because that leading whitespace isn't there
anymore, i would suggest that it's the *script* that's broken.

rday



More information about the busybox mailing list