On Wed, 2 Oct 2002, John W. Krahn wrote:

> "John W. Krahn" wrote:
> > 
> > Sudarshan Raghavan wrote:
> > >
> > > On Wed, 2 Oct 2002, jontn_swift wrote:
> > >
> > > > This is a classic case for my favorite one-liner:
> > > >
> > > > perl -e'while(<>){print unless $seen{$_}++}' <infile >outfile
> > >
> > > You favourite one-liner can be even shorter
> > > perl -n -e 'print unless $seen{$_}++' infile >outfile
> > 
> > You want short?  :-)
> > 
> > perl -ne'$s{$_}++||print' infile >outfile
> 
> Or if you want something a bit more obfuscated.
> 
>   perl -pe'$+{$_}++&&y+++cd' infile >outfile
> 
>   perl -pe'$s{$_}++&&s{.+}$$s' infile >outfile

Thanks for that :-), learnt a couple of things in the process of 
understanding the second one.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to