extracting server information from the whois command.

  • Hey guys I am hoping some of you guys might be able to help me with a script I am working on. I am trying to extract just the name server information when using the whois command. for example this is the whois name server for ebay:

    Code
    Name Server: smf-dns1.ebaydns.com
    Name Server: smf-dns2.ebaydns.com
    Name Server: ns1.p47.dynect.net
    Name Server: sjc-dns1.ebaydns.com
    Name Server: sjc-dns2.ebaydns.com


    At the moment I have this:

    Code
    whois ebay.com | grep -E "[Ss]ervers{0,1}:"


    But I have noticed some websites format the name servers differently i.e. some have nservers, Name Servers etc... But the one that is catching me is websites that list the servers on a new line. e.g.

    Code
    Name Server: 
    smf-dns1.test.com
    smf-dns2.test.com


    Have any of you guys any idea how I be able to get the server addresses that are on the new line but also flexible enough that it will work with other websites that are on one line.

Chat about everything else!

A friendly forum for off-topic discussions, random questions, and community bonding. Your space for conversations outside our main categories. Discuss hobbies, news, games, or anything else with the wider community.