bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils uniq -d -u does not conform to POSIX


From: Paul Eggert
Subject: Re: coreutils uniq -d -u does not conform to POSIX
Date: 29 May 2003 11:36:40 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden writes:

> There are other invalid combinations not handled either:
> See the last 6 lines of this patch for a summary:
> http://www.pixelbeat.org/patches/textutils-2.0.21-uniq-group.diff

I don't quite follow.  The last six lines seem to claim that the
following pairs of options are invalid:

-D -c
-G -c
-D -G
-D -u
-u -d
-D -d

But -u -d is clearly valid, since POSIX says it's valid.
In the documentation part of the patch that I sent, we have:

(default) Discard the second and subsequent repeated lines.
-d Discard lines that are not repeated.
-u Discard the first repeated line.
-D Do not discard the second and subsequent repeated lines,
   but discard lines that are not repeated.

Under this convention, -D is not incompatible with -d or with -u.
It is incompatible with -c, and the patched uniq.c checks for that.

coreutils uniq does not have the -G option, but if it did it would
behave like this:

-G Do not discard the second and subsequent repeated line.

That is, -D is equivalent to -d -G.  Under this interpretation, -G is
also incompatible with -c, but it's not incompatible with any other
option.

Perhaps it would be better for coreutils uniq to drop the -D option,
and to have -G instead.  With -G, one can easily simulate -D (since -D
== -d -G), but the converse is not true.  Or if backward compatibility
is a concern, perhaps -G should be added.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]