Re: sort stdin and print

2004-03-18 Thread John W. Krahn
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/; > >

Re: sort stdin and print

2004-03-18 Thread rmck
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

Re: sort stdin and print

2004-03-18 Thread John W. Krahn
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

Re: sort stdin and print

2004-03-18 Thread Wiggins d Anconia
> 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

RE: sort stdin and print

2004-03-18 Thread Jayakumar Rajagopal
#!/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//;

RE: sort stdin and print

2004-03-18 Thread Ned Cunningham
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//;