in reply to RE (tilly) 1: remove duplicate lines from input file
in thread remove duplicate lines from input file

or: perl -ne '$seen{$_}++ or print' file
  • Comment on RE: RE (tilly) 1: remove duplicate lines from input file

Replies are listed 'Best First'.
RE: RE: RE (tilly) 1: remove duplicate lines from input file
by japhy (Canon) on Sep 23, 2000 at 07:55 UTC
    Or even (golf alert): perl -ne '${$_}||=print' file (although it's not strict compliant, and breaks if strings have NULLs in them).

    $_="goto+F.print+chop;\n=yhpaj";F1:eval
RE (tilly) 3: remove duplicate lines from input file
by tilly (Archbishop) on Sep 23, 2000 at 11:27 UTC
    If you follow the thread I linked you would find discussion of essentially that alternative. Using ++$seen{$_} was noticably faster because you avoid unnecessary scalar creation.