On 12/01/15 14:13, Jonathan David Amery wrote:
> Package: coreutils
> Version: 8.13-3.5
> Severity: normal
> 
> I was attempting to use uniq to categorise my data based on the first so
> many characters and I discover that:
> 
> a) it is currently impossible to use uniq to output all lines; with lines 
>   grouped by initial prefix ( -w N ) and separated by an empty line 
>   (--all-repeated=separate) because there is no way to specify outputing
>   all lines
> b) the combination behaviour of -u -d and -D is odd and suboptimal.
> 
> Here is an example with a small example dataset:
> 
> :; cat > uniq-test
> AAA
> AAB
> ABA
> ABC
> ACA
> ADA
> ADD
> ADE
> :; uniq -w 2 -u uniq-test
> ACA
> :; uniq -w 2 -d uniq-test
> AAA
> ABA
> ADA
> :; uniq -w 2 -D uniq-test
> AAA
> AAB
> ABA
> ABC
> ADA
> ADD
> ADE
> :; uniq -w 2 -ud uniq-test
> :; uniq -w 2 -du uniq-test
> :; uniq -w 2 --all-repeated=separate uniq-test
> AAA
> AAB
> 
> ABA
> ABC
> 
> ADA
> ADD
> ADE
> :; uniq -w 2 -u --all-repeated=separate uniq-test
> AAA
> 
> ABA
> 
> ADA
> ADD
> :; uniq -w 2 -c -D uniq-test
> uniq: printing all duplicated lines and repeat counts is meaningless
> Try `uniq --help' for more information.
> :;
> 
>  So in summary:
> 
>  -ud or -du produces no output; but doesn't produce an error (where -c -D 
> does)
> 
>  -u -D produces unexpected output (all the repeated lines except the last one 
>    for each set).
> 
>  There is no way to output all lines, with separations.
> 
>  There are a number of ways to address this issue; but I think the best one
> would be to correct behavior and documentation such that:
> 
>  -u outputs any lines which are unique
>  -d outputs the first of any lines which are duplicated
>  -D outputs all lines which are duplicated
>  --all-repeated=METHOD seperates any groups of lines in the specified behavior
> 
>  Such that the output I wanted would be produced with:
> 
> :; uniq -w 2 -u --all-repeated=separate uniq-test
> AAA
> AAB
> 
> ABA
> ABC
> 
> ACA
> 
> ADA
> ADD
> ADE
> :;
> 
>  Thanks,
> 
> J.

Upstream has gone with uniq --group since version 8.22


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to