1

I am trying to interpret the WHOIS data which was output using a custom service. The data looks like this:

{
  "rawText": "MarkMonitor is the Global Leader in Online Brand Protection.\r\n\r\nDomain Management\r\nMarkMonitor Brand Protection\u2122\r\nMarkMonitor AntiPiracy\u2122\r\nMarkMonitor AntiFraud\u2122\r\nP
rofessional and Managed Services\r\n\r\nVisit MarkMonitor at www.markmonitor.com\r\nContact us at 1 (800) 745-9229\r\nIn Europe, at +44 (0) 203 206 2220\r\n\r\nThe Data in MarkMonitor.com's WHOIS database 
is provided by MarkMonitor.com\r\nfor information purposes, and to assist persons in obtaining information\r\nabout or related to a domain name registration record.  MarkMonitor.com\r\ndoes not guarantee i
ts accuracy.  By submitting a WHOIS query, you agree\r\nthat you will use this Data only for lawful purposes and that, under no\r\ncircumstances will you use this Data to: (1) allow, enable, or otherwise\r
\nsupport the transmission of mass unsolicited, commercial advertising or\r\nsolicitations via e-mail (spam); or  (2) enable high volume, automated,\r\nelectronic processes that apply to MarkMonitor.com (o
r its systems).\r\nMarkMonitor.com reserves the right to modify these terms at any time.\r\nBy submitting this query, you agree to abide by this policy.\r\n\r\nRegistrant:\r\n        Dns Admin\r\n        G
oogle Inc.\r\n        Please contact contact-admin@google.com 1600 Amphitheatre Parkway\r\n         Mountain View CA 94043\r\n        US\r\n        dns-admin@google.com +1.6502530000 Fax: +1.6506188571\r\n
\r\n    Domain Name: google.com\r\n\r\n        Registrar Name: Markmonitor.com\r\n        Registrar Whois: whois.markmonitor.com\r\n        Registrar Homepage: http://www.markmonitor.com\r\n\r\n    Adminis
trative Contact:\r\n        DNS Admin\r\n        Google Inc.\r\n        1600 Amphitheatre Parkway\r\n         Mountain View CA 94043\r\n        US\r\n        dns-admin@google.com +1.6506234000 Fax: +1.6506
188571\r\n    Technical Contact, Zone Contact:\r\n        DNS Admin\r\n        Google Inc.\r\n        2400 E. Bayshore Pkwy\r\n         Mountain View CA 94043\r\n        US\r\n        dns-admin@google.com 
+1.6503300100 Fax: +1.6506181499\r\n\r\n    Created on..............: 1997-09-15.\r\n    Expires on..............: 2020-09-13.\r\n    Record last updated on..: 2012-01-29.\r\n\r\n    Domain servers in list
ed order:\r\n\r\n    ns2.google.com\r\n    ns1.google.com\r\n    ns3.google.com\r\n    ns4.google.com\r\n    \r\n\r\n\r\n\r\nMarkMonitor is the Global Leader in Online Brand Protection.\r\n\r\nDomain Manag
ement\r\nMarkMonitor Brand Protection\u2122\r\nMarkMonitor AntiPiracy\u2122\r\nMarkMonitor AntiFraud\u2122\r\nProfessional and Managed Services\r\n\r\nVisit MarkMonitor at www.markmonitor.com\r\nContact us
 at 1 (800) 745-9229\r\nIn Europe, at +44 (0) 203 206 2220\r\n\r\n--",
  "strippedText": "Registrant:\nDns Admin\nGoogle Inc.\nPlease contact contact-admin@google.com 1600 Amphitheatre Parkway\nMountain View CA 94043\nUS\ndns-admin@google.com +1.6502530000 Fax: +1.6506188571\
n\nDomain Name: google.com\n\nRegistrar Name: Markmonitor.com\nRegistrar Whois: whois.markmonitor.com\nRegistrar Homepage: http://www.markmonitor.com\n\nAdministrative Contact:\nDNS Admin\nGoogle Inc.\n160
0 Amphitheatre Parkway\nMountain View CA 94043\nUS\ndns-admin@google.com +1.6506234000 Fax: +1.6506188571\nTechnical Contact, Zone Contact:\nDNS Admin\nGoogle Inc.\n2400 E. Bayshore Pkwy\nMountain View CA 
94043\nUS\ndns-admin@google.com +1.6503300100 Fax: +1.6506181499\n\nCreated on..............: 1997-09-15.\nExpires on..............: 2020-09-13.\nRecord last updated on..: 2012-01-29.\n\nDomain servers in 
listed order:\nns2.google.com\nns1.google.com\nns3.google.com\nns4.google.com\n",
  "domainNameExt": ".com",
  "domainName": "google.com",
  "audit": {
    "updatedDate": {
      "$": "2012-10-09 15:53:51.0",
      "@class": "sql-timestamp"
    },
    "createdDate": {
      "$": "2012-10-09 15:53:51.0",
      "@class": "sql-timestamp"
    }
  },
  "technicalContact": {
    "rawText": "DNS Admin\nGoogle Inc.\n2400 E. Bayshore Pkwy\nMountain View CA 94043\nUS\ndns-admin@google.com +1.6503300100 Fax: +1.6506181499\n",
    "city": "Mountain View",
    "fax": "+1.6503300100 ",
    "name": "DNS Admin",
    "street1": "2400 E. Bayshore Pkwy",
    "telephone": "+1.6503300100 ",
  }
}

The data has been shortened for readability. I want to display this well on the command line so that is easier to read, meaning I should be able to interpret the special chars (\n,\r,\t). I tried using:

whoisout google.com | xargs -I LINE echo -e LINE

but this does not preserve the spaces before any line. Any idea how can I display this correctly?

  • Quick glance says that's JSON. So you want to use some JSON utilities to do it. A quick search suggests looking at jq. – derobert Jul 26 '13 at 20:08
  • Well the JSON part (such as pretty printing) tool plays a part only in indenting the data but not interpreting the escaped chars. I did try python -mjson.tool but to no avail. – sandyp Jul 26 '13 at 20:12
  • No, the escaped characters are part of JSON too. – derobert Jul 26 '13 at 20:12
  • Tried again ... didn't solve my problem. – sandyp Jul 26 '13 at 21:06
  • Do you want to display the rawText part? Or to prettyprint the whole thing? – Gilles 'SO- stop being evil' Jul 26 '13 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.