Subject: Re: bug#10365: [PATCH] uniq: add ability to skip last N chars or fields

From: Pádraig Brady <[email-masked]>
Date: Mon, 26 Dec 2011 19:35:52 +0000

On 12/26/2011 07:00 PM, Adrien Kunysz wrote:
> On Mon, Dec 26, 2011 at 05:42:25PM +0100, Jim Meyering wrote:
>> Pádraig Brady wrote:
>>
>>> On 12/25/2011 12:54 PM, Adrien Kunysz wrote:
>>>> * doc/coreutils.texi: document the new feature
>>>> * src/uniq.c (find_end): new function
>>>> (check_file): use find_end() to determine when to stop comparing
>>>> (usage): document the new feature
>>>> (main): expose the new feature to user
>>>> * tests/misc/uniq: add tests to exercise the new code
>>>> ---
>>>>  doc/coreutils.texi |   17 +++++++++++++
>>>>  src/uniq.c         |   69 +++++++++++++++++++++++++++++++++++++++++++++++++---
>>>>  tests/misc/uniq    |   15 +++++++++++
>>>>  3 files changed, 97 insertions(+), 4 deletions(-)
>>>>
>>>> I have recently found myself wishing I could have uniq(1) skip
>>>> the last N fields before comparison. I am aware of the rev(1) trick
>>>> but I don't find it very satisfactory. So I ended up patching uniq
>>>> and implementing the feature for characters skipping as well.
>>>>
>>>> Documentation and tests included. Tests have also been run within
>>>> Valgrind on x86_64.
>>>
>>> Thank you for being so thorough.
>>>
>>> Hmm, this is quite unusual functionality.
>>> I was about to merge this with a previous feature request:
>>> http://debbugs.gnu.org/5832
>>> But in fact supporting --key would not provide this functionality.
>>>
>>> Why does `rev | uniq -f | rev` not suffice for you?
> 
> It just doesn't look very nice to me but I admit it actually works fine.

OK given this, and that --key should handle most of these cases,
I'm going to close this request.

cheers,
Pádraig.