bug-coreutils
[Top][All Lists]
Advanced

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

bug#10287: [wishlist] uniq can remove non adjacent lines


From: Stéphane Blondon
Subject: bug#10287: [wishlist] uniq can remove non adjacent lines
Date: Wed, 14 Dec 2011 23:30:12 +0100

2011/12/13 Bob Proulx <address@hidden>:
> 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





reply via email to

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