extracting domains from whois query 
Author Message
 extracting domains from whois query

OK.  I am trying to perform a whois '$name.' and extract the domains
that are output as $results.


and perfom a foreach type output.

For example, if I do the query for 'pepsi.', I get this (shortened
version):

PEPSI-LACROSS.COMPepsi-Cola (PEPSI-LACROSSE-DOM)   PEPSI-LACROSSE.COM
Pepsi-Cola (PEPSI-MANKATO-DOM)                      PEPSI-MANKATO.COM
Pepsi-Cola (PEPSI-ROCHESTER-DOM)                  PEPSI-ROCHESTER.COM
Pepsi-Online.com (PEPSI-ONLINE3-DOM)                 PEPSI-ONLINE.COM
Pepsi-Online.net (PEPSI-ONLINE-DOM)                  PEPSI-ONLINE.NET
Pepsi-Online.org (PEPSI-ONLINE2-DOM)                 PEPSI-ONLINE.ORG

I want to extract only the list on the right hand side (the domains).

Can anyone please help me with this?

Thanks,
Chad.

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Thu, 27 Dec 2001 03:00:00 GMT  
 extracting domains from whois query

Quote:

>OK.  I am trying to perform a whois '$name.' and extract the domains
>that are output as $results.


>and perfom a foreach type output.

>For example, if I do the query for 'pepsi.', I get this (shortened
>version):

[snip data reproduced below]

Quote:

>I want to extract only the list on the right hand side (the domains).

>Can anyone please help me with this?

#!/usr/bin/perl -w

use strict;

foreach (<DATA>) {
        print "$1\n" if /\)\s+(.*)/

Quote:
}

__DATA__
PEPSI-LACROSS.COMPepsi-Cola (PEPSI-LACROSSE-DOM)   PEPSI-LACROSSE.COM
Pepsi-Cola (PEPSI-MANKATO-DOM)                      PEPSI-MANKATO.COM
Pepsi-Cola (PEPSI-ROCHESTER-DOM)                  PEPSI-ROCHESTER.COM
Pepsi-Online.com (PEPSI-ONLINE3-DOM)                 PEPSI-ONLINE.COM
Pepsi-Online.net (PEPSI-ONLINE-DOM)                  PEPSI-ONLINE.NET
Pepsi-Online.org (PEPSI-ONLINE2-DOM)                 PEPSI-ONLINE.ORG

Marcel
--



Thu, 27 Dec 2001 03:00:00 GMT  
 extracting domains from whois query

: OK.  I am trying to perform a whois '$name.' and extract the domains
: that are output as $results.

: I want to extract only the list on the right hand side (the domains).

: Can anyone please help me with this?

----------------------
#!/usr/bin/perl -w
use strict;




   print "$_\n";

Quote:
}

__DATA__
PEPSI-LACROSS.COMPepsi-Cola (PEPSI-LACROSSE-DOM)   PEPSI-LACROSSE.COM
Pepsi-Cola (PEPSI-MANKATO-DOM)                      PEPSI-MANKATO.COM
Pepsi-Cola (PEPSI-ROCHESTER-DOM)                  PEPSI-ROCHESTER.COM
Pepsi-Online.com (PEPSI-ONLINE3-DOM)                 PEPSI-ONLINE.COM
Pepsi-Online.net (PEPSI-ONLINE-DOM)                  PEPSI-ONLINE.NET
Pepsi-Online.org (PEPSI-ONLINE2-DOM)                 PEPSI-ONLINE.ORG
----------------------

--
    Tad McClellan                          SGML Consulting

    Fort Worth, Texas



Thu, 27 Dec 2001 03:00:00 GMT  
 extracting domains from whois query

Quote:
> OK.  I am trying to perform a whois '$name.' and extract the domains
> that are output as $results.


> and perfom a foreach type output.

> For example, if I do the query for 'pepsi.', I get this (shortened
> version):

> Pepsi-Online.org (PEPSI-ONLINE2-DOM)                 PEPSI-ONLINE.ORG

> I want to extract only the list on the right hand side (the domains).

The fields are separated by tabs - you can use split /\t+/ to do this -
you might be left with some leading whitespace on the domains: how to
remove this is covered in the FAQ.

Bear in mind this will probably not work with whois records that use the
RIPE format - or rather will probably only work with INTERNIC format.

/J\
--

Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>



Thu, 27 Dec 2001 03:00:00 GMT  
 extracting domains from whois query


...

Quote:



>    print "$_\n";
> }

That chomp, etc. is a singularly longwinded and inefficient way to do:


Maybe we need an award for the Perl-golf losers as well.  :-)

I rather like this one-liner, which might win at golf and would work
well from the command line too:

  print map /(\S+\n)/, <DATA>;

--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/



Thu, 27 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. need regex to extract domain.name from host.domain.name

2. Domain Whois Search Scripts.

3. WHOIS not standart query HELP!!!

4. WHOIS not standart query HELP!!!

5. CGI for WHOIS queries - Advice please

6. How to Query Whois

7. advanced whois query

8. Using domain.com/?query+string and domain.com/index.cgi?query+string...

9. How to extract the toplevel-domain of a domainame from a string with regexp

10. extracting domain names

11. Extracting top level domain from remote host

12. Extracting Domain

 

 
Powered by phpBB® Forum Software