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
> >>>
> >>>
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
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{$_
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:
>
>
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:
>
>
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
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
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/
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 "} =="
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
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/
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
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;
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
---
#!/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
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;
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
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
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
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
>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
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
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
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,
> >
>
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
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:/
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
27 matches
Mail list logo