Re: removing duplicates

2008-04-30 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Jenda Krynicky wrote: > > From: "John W. Krahn" <[EMAIL PROTECTED]> > >> Rob Dixon wrote: > >>> obdulio santana wrote: > May be this helps > > perl -lne "print if ++$D{$_} == 1" address.txt > >>> You may prefer the cuteness of > >>> > >>>

Re: removing duplicates

2008-04-29 Thread Chas. Owens
On Tue, Apr 29, 2008 at 8:06 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote: snip > perl -n'${$_}||=print' snip That is nasty. If I am reading that correctly you are using a symbolic reference to create variables with the name of the line. I can't remember, does Perl have a limit on the size of

Re: removing duplicates

2008-04-29 Thread John W. Krahn
Jenda Krynicky wrote: From: "John W. Krahn" <[EMAIL PROTECTED]> Rob Dixon wrote: obdulio santana wrote: May be this helps perl -lne "print if ++$D{$_} == 1" address.txt You may prefer the cuteness of perl -lne "print unless $D{$_}++" address.txt Or the shortness of: perl -ne'$D{$_

Re: removing duplicates

2008-04-29 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Rob Dixon wrote: > > obdulio santana wrote: > >> May be this helps > >> > >> perl -lne "print if ++$D{$_} == 1" address.txt > > > > You may prefer the cuteness of > > > > perl -lne "print unless $D{$_}++" address.txt > > Or the shortness of: > >

Re: removing duplicates

2008-04-29 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Rob Dixon wrote: > > obdulio santana wrote: > >> May be this helps > >> > >> perl -lne "print if ++$D{$_} == 1" address.txt > > > > You may prefer the cuteness of > > > > perl -lne "print unless $D{$_}++" address.txt > > Or the shortness of: > >

Re: removing duplicates

2008-04-29 Thread John W. Krahn
Rob Dixon wrote: obdulio santana wrote: May be this helps perl -lne "print if ++$D{$_} == 1" address.txt You may prefer the cuteness of perl -lne "print unless $D{$_}++" address.txt Or the shortness of: perl -ne'$D{$_}++||print' address.txt John -- Perl isn't a toolbox, but a sma

Re: removing duplicates

2008-04-29 Thread Rob Dixon
Rob Dixon wrote: > obdulio santana wrote: >> May be this helps >> >> perl -lne "print if ++$D{$_} == 1" address.txt > > You may prefer the cuteness of > > perl -lne "print unless $D{$_}++" address.txt My apologies. That requires single quotes: perl -lne 'print unless $D{$_}++' address.txt

Re: removing duplicates

2008-04-29 Thread Rob Dixon
obdulio santana wrote: > May be this helps > > perl -lne "print if ++$D{$_} == 1" address.txt You may prefer the cuteness of perl -lne "print unless $D{$_}++" address.txt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: removing duplicates

2008-04-29 Thread John W. Krahn
sivasakthi wrote: On Tue, 2008-02-05 at 14:40 -0500, obdulio santana wrote: May be this helps perl -lne "print if ++$D{$_} == 1" address.txt I have tried the above command , but it shows the following error, Can't modify single ref constructor in preincrement (++) at -e line 1, near "} =="

Re: removing duplicates

2008-04-29 Thread sivasakthi
On Tue, 2008-02-05 at 14:40 -0500, obdulio santana wrote: > May be this helps > > perl -lne "print if ++$D{$_} == 1" address.txt > > regards > > > I have tried the above command , but it shows the following error, Can't modify single ref constructor in preincrement (++) at -e line 1, near

Re: removing duplicates

2008-02-05 Thread boll
Rob Dixon wrote: boll wrote: I'm trying to write a script to remove duplicate e-mail addresses from a list. I'd like some help understanding... 1. Why does it remove all but one of the duplicate lines? 2. How can I fix it? Thanks for any advice, John --- #!/usr/bin/

Re: removing duplicates

2008-02-05 Thread obdulio santana
May be this helps perl -lne "print if ++$D{$_} == 1" address.txt regards 2008/2/5, Rob Dixon <[EMAIL PROTECTED]>: > > boll wrote: > > I'm trying to write a script to remove duplicate e-mail addresses from a > > list. > > I'd like some help understanding... > > 1. Why does it remove all but on

Re: removing duplicates

2008-02-05 Thread Rob Dixon
boll wrote: I'm trying to write a script to remove duplicate e-mail addresses from a list. I'd like some help understanding... 1. Why does it remove all but one of the duplicate lines? 2. How can I fix it? Thanks for any advice, John --- #!/usr/bin/perl use warnings;

Re: removing duplicates

2008-02-05 Thread Chas. Owens
On Feb 5, 2008 1:18 AM, boll <[EMAIL PROTECTED]> wrote: > I'm trying to write a script to remove duplicate e-mail addresses from a > list. > I'd like some help understanding... > 1. Why does it remove all but one of the duplicate lines? snip Because that is what the code says to do. It says to pr

Re: removing duplicates

2008-02-05 Thread 亂世貓熊
--- #!/usr/bin/perl use warnings; use strict; open ALLNAMES, "emails.txt" or die "File: infile failed to open: $!\n"; my @allnames = ; chomp @allnames ; # I don't know why, but seems you need this my %seen = (); my @unique = grep { ! $seen{ $_ }++ } @allnames; pr

removing duplicates

2008-02-05 Thread boll
I'm trying to write a script to remove duplicate e-mail addresses from a list. I'd like some help understanding... 1. Why does it remove all but one of the duplicate lines? 2. How can I fix it? Thanks for any advice, John --- #!/usr/bin/perl use warnings; use strict;

Re: hash. removing duplicates

2004-10-18 Thread Jeff 'japhy' Pinyan
On Oct 18, Vladimir Lemberg said: >John Creamer: 123 345 123 678 345 >Erick Morillo: 123 432 876 123 432 >Cris Fortier: 678 123 987 123 345 > >I need to remove duplicated numbers from each line. The output file would be: > >John Creamer: 123 345 678 >Erick Morillo: 123 432 876 >Cris Fortier: 678 1

RE: hash. removing duplicates

2004-10-18 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Vladimir Lemberg wrote: > Hi All, > > Could you help me resolve following problem. > > > > I have file: > > John Creamer: 123 345 123 678 345 > > Erick Morillo: 123 432 876 123 432 > > Cris Fortier: 678 123 987 123 345 > > > > I need to remove duplicated numbers from each line. The output

hash. removing duplicates

2004-10-18 Thread Vladimir Lemberg
Hi All, Could you help me resolve following problem. I have file: John Creamer: 123 345 123 678 345 Erick Morillo: 123 432 876 123 432 Cris Fortier: 678 123 987 123 345 I need to remove duplicated numbers from each line. The output file would be: John Creamer: 123 345 678 Erick Mo

RE: Removing duplicates in arrays

2003-10-22 Thread Marcos . Rebelo
keys{%{{map {$_=>$_}(@array)}}); -Original Message- From: Marius Roets [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 7:29 AM To: [EMAIL PROTECTED] Subject: Removing duplicates in arrays I know this has been asked before, but I can't seem to find it. Is there a si

Re: Removing duplicates in arrays

2003-10-22 Thread Stefan Lidman
>I know this has been asked before, but I can't seem to find it. >Is there a simple way to remove duplicates from an array. >Currently I sort the array, and then iterate through the sorted array, >and push elements into a new array when its different than the previous >one. I have read somewhere of

Removing duplicates in arrays

2003-10-22 Thread Marius Roets
I know this has been asked before, but I can't seem to find it. Is there a simple way to remove duplicates from an array. Currently I sort the array, and then iterate through the sorted array, and push elements into a new array when its different than the previous one. I have read somewhere of a on

RE: Removing duplicates from an array

2003-02-10 Thread Perry, Alan
See below. Beau E. Cox wrote: > Hi - > >> From: R. Joseph Newton [mailto:[EMAIL PROTECTED]] >> Subject: Re: Removing duplicates from an array >> >> Troy May wrote: >> >>> Hello, >>> >>> What's the best and cleanest way

RE: Removing duplicates from an array

2003-02-09 Thread Beau E. Cox
Hi - > -Original Message- > From: R. Joseph Newton [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 09, 2003 3:32 PM > To: Troy May > Cc: Perl List > Subject: Re: Removing duplicates from an array > > > Troy May wrote: > > > Hello, > > >

Re: Removing duplicates from an array

2003-02-09 Thread R. Joseph Newton
Troy May wrote: > Hello, > > What's the best and cleanest way to remove duplicates from an array? I have > an array that reads entries from a text file and I would like to remove all > the duplicates from it. > > Thanks in advance! > > Troy I'd say prevention is the best cure. Check for duplica

Re: Removing duplicates from an array

2003-02-09 Thread Jenda Krynicky
From: "Troy May" <[EMAIL PROTECTED]> > What's the best and cleanest way to remove duplicates from an array? > I have an array that reads entries from a text file and I would like > to remove all the duplicates from it. Run perldoc -q duplicate :-) Jenda = [EMAIL PROTECTED] === http:/

Removing duplicates from an array

2003-02-09 Thread Troy May
Hello, What's the best and cleanest way to remove duplicates from an array? I have an array that reads entries from a text file and I would like to remove all the duplicates from it. Thanks in advance! Troy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL