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: Bob Proulx <bob <at> proulx.com>
To: 10287 <at> debbugs.gnu.org
Subject: bug#10287: [wishlist] uniq can remove non adjacent lines
Date: Tue, 13 Dec 2011 11:09:55 -0700
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]++'

I like it!  I will definitely be using that awk idiom in the future.
It is simple and concise.

Bob




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.