GNU bug report logs - #10287
[wishlist] uniq can remove non adjacent lines

Previous Next

Package: coreutils;

Reported by: Stéphane Blondon <stephane.blondon <at> gmail.com>

Date: Tue, 13 Dec 2011 02:52:01 UTC

Severity: wishlist

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stéphane Blondon <stephane.blondon <at> gmail.com>
To: 10287 <at> debbugs.gnu.org
Subject: bug#10287: [wishlist] uniq can remove non adjacent lines
Date: Wed, 14 Dec 2011 23:30:12 +0100
2011/12/13 Bob Proulx <bob <at> proulx.com>:
> Davide Brini wrote:
>> Bob Proulx wrote:
>> >   perl -lne 'print $_ if ! defined $a{$_}; $a{$_}=$_;'
>>
>> While we're at it, this is the typical awk way to do that:
>>
>> awk '!a[$0]++'

Very great thanks to you and David about providing a one-liner
solution! I've modified the awk version in order it works as an alias.
I send it in case some one asks the same question:

Copy-paste the next line in ~/.bash_aliases:
alias uniqall='awk '"'"'! a[$0]++'"'"''

Then you can filter like that:
cat file | ... | uniqall | ...


(tested with bash, version 4.2.20(1)-release under Debian Wheezy)

Thanks and good bye,
-- 
Stéphane




This bug report was last modified 13 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.