Rmck wrote:
>
> From: "John W. Krahn" <[EMAIL PROTECTED]>
> >
> > I would do it something like this:
> >
> > #!/usr/bin/perl
> > use warnings;
> > use strict;
> > use Socket;
> >
> > my %IPs;
> > while ( <> ) {
> > $IPs{ inet_aton( $1 ) }++ if /\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b/;
> >
22.81.97
Total IP'S = 2
Not Ip=111.111.13473
Thanks,
Rob
-Original Message-
From: "John W. Krahn" <[EMAIL PROTECTED]>
Sent: Mar 18, 2004 10:39 AM
To: [EMAIL PROTECTED]
Subject: Re: sort stdin and print
Rmck wrote:
>
> HI
Hello,
> I have a script that
Rmck wrote:
>
> HI
Hello,
> I have a script that reads stdin from the output of another script
> and cleans it up and prints it. The script gets ip's.
>
> I would like to sort it and and eliminate duplicates count the
> sorted/unique ips then print???
The best way to store unique values is to
> HI
>
> I have a script that reads stdin from the output of another script and
cleans it up and prints it. The script gets ip's.
>
> I would like to sort it and and eliminate duplicates count the
sorted/unique ips then print???
Ok then do that ;-)
>
> I thought using the perl sort comman
#!/usr/bin/perl
use strict;
my $count = 0;
my %line ={};# - create a uniq line hash
while( <> ) { #read from stdin one line or record at a time
s/ipadd://; #if line has ipadd: remove it
s/^ |\t//;
I am sure there are better ways but you could save the current ip and check it?
#!/usr/bin/perl
use strict;
my $count = 0;
while( <> ) { #read from stdin one line or record at a time
s/ipadd://; #if line has ipadd: remove it
s/^ |\t//;