.
ta,
>From: Casey West <[EMAIL PROTECTED]>
>To: "M.W. Koskamp" <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED], cherukuwada subrahmanyam <[EMAIL PROTECTED]>,
>[EMAIL PROTECTED]
>Subject: Re: eliminating duplicate lines in a file
>Date: Wed, 2 May 2001 1
On Wed, May 02, 2001 at 11:11:20AM -0700, Paul wrote:
:
: --- "M.W. Koskamp" <[EMAIL PROTECTED]> wrote:
: > > : open FH, "lines.txt" || die $!;
: > > : my %uniq;
: > > : map{$uniq{$_}=1 and print $_ unless $uniq{$_} };
:
: lol -- one better(ish):
: print map { $uniq{$_} ? '' : $uniq{$_}=$_
--- "M.W. Koskamp" <[EMAIL PROTECTED]> wrote:
> > : open FH, "lines.txt" || die $!;
> > : my %uniq;
> > : map{$uniq{$_}=1 and print $_ unless $uniq{$_} };
lol -- one better(ish):
print map { $uniq{$_} ? '' : $uniq{$_}=$_ } ; #:op
__
Do You Ya
- Original Message -
From: Casey West <[EMAIL PROTECTED]>
To: M.W. Koskamp <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; cherukuwada subrahmanyam <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2001 6:45 PM
Subject: Re: eliminating duplic
brahmanyam <[EMAIL PROTECTED]> wrote:
: > Hi,
: > Iam reading flat text file of 10 lines. Each line has got data of
: > maximum 10 characters.
: > I want to eliminate duplicate lines and blank lines out of that file.
: > i.e. something like sort -u in unix.
:
: Got plenty of memory? =o)
:
:
On Wed, May 02, 2001 at 07:39:03PM +0200, M.W. Koskamp wrote:
:
: - Original Message -
: From: Paul <[EMAIL PROTECTED]>
: To: cherukuwada subrahmanyam <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
: Sent: Wednesday, May 02, 2001 7:08 PM
: Subject: Re: eliminating duplica
- Original Message -
From: Paul <[EMAIL PROTECTED]>
To: cherukuwada subrahmanyam <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2001 7:08 PM
Subject: Re: eliminating duplicate lines in a file
>
> --- cherukuwada subrahmanyam <[EMAI
--- cherukuwada subrahmanyam <[EMAIL PROTECTED]> wrote:
> Hi,
> Iam reading flat text file of 10 lines. Each line has got data of
> maximum 10 characters.
> I want to eliminate duplicate lines and blank lines out of that file.
> i.e. something like sort -u in unix.
Got plenty of memory? =o)
At 07:57 AM 5/2/2001, you wrote:
>Hi,
>Iam reading flat text file of 10 lines. Each line has got data of
>maximum 10 characters.
>I want to eliminate duplicate lines and blank lines out of that file.
>i.e. something like sort -u in unix.
>
>
>
>Is there any easy way of doing it in perl???
>th
You can try this old trick:
# where @data is from flatfile
%seen = ();
@uniq = (); #will contain only unique elements
foreach $item(@data) {
unless($seen{$item}) {
$seen{$item} = 1;
if ($item =~ /\S+/g) {
push(@uniq,
Hi,
Iam reading flat text file of 10 lines. Each line has got data of
maximum 10 characters.
I want to eliminate duplicate lines and blank lines out of that file.
i.e. something like sort -u in unix.
Example:
if the file contains:
abcdef
dfsdf
abcdef
dfsdf
12334
Then the output should be:
11 matches
Mail list logo