[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13032: 24.3.50; Request: Provide a `delete-duplicate-lines' command
From: |
Dani Moncayo |
Subject: |
bug#13032: 24.3.50; Request: Provide a `delete-duplicate-lines' command |
Date: |
Fri, 30 Nov 2012 08:51:34 +0100 |
>>> C-u M-| awk -- '!a[$0]++' RET
>>
>> Isn't
>>
>> C-u M-| uniq RET
>>
>> shorter and easier to type?
>
> I use `uniq' only on files where lines are sorted. OTOH, something like
> '!a[$0]++' that is not limited to consecutive duplicates is better for
> files where lines are not sorted such as log files, etc.
My use cases usually involves compacting a collection of lines
gathered from several places. So the compacting operation is normally
coupled with a sort operation.
Thus, the command provided by Juanma is good enough for these use
cases (I first do a `sort-lines' and then a `delete-duplicate-lines').
But I agree that it would be even better if `delete-duplicate-lines'
did TRT even when the lines are not sorted. (I've just tested this
feature in MS-Excel, and it is so: it doesn't requires that the lines
are previously sorted)
Thank you.
--
Dani Moncayo
bug#13032: 24.3.50; Request: Provide a `delete-duplicate-lines' command, Dani Moncayo, 2012/11/30