uniq -c formatting

Eric Spakman E.Spakman at inter.nl.net
Tue Jul 18 11:41:40 UTC 2006


Hi Robert,
>
>> 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.
>
It's not that the script is breaking, but the formatting of its output.
Anyway, it was more a question of why the output of uniq changed, if it
was intentional or simply overlooked.

> rday
>
Eric




More information about the busybox mailing list