Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 428101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:38:32+00:00 2026-05-12T19:38:32+00:00

I work for a company that offers webhosting and DNS services. We are trying

  • 0

I work for a company that offers webhosting and DNS services. We are trying to migrate everything over to new servers and we’ve often run into stale zonefiles on our servers as customers have changed their authoritative servers to someone else.

I am trying to write a script that will check whois, ns, and SOA information to determine if a domain still uses us as an authoritative server.

I am attempting to use sed to filter the output of the following to display only the nameserver without the trailing “.”:

dig +noall +answer soa yahoo.com | sed 's/.*SOA\s*//' | sed 's/\.$//'

I’ve searched the net, but most sed command examples work on “lines” instead of “Words”.

The desired output would be as follows:

$ dig +noall +answer soa yahoo.com | sed '<Some SED code here>'
ns1.yahoo.com

Any suggestions would be helpful.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:38:32+00:00Added an answer on May 12, 2026 at 7:38 pm

    Rather than using removing the part that you don’t want, I would suggest using a bracketed subexpression to identify the bit that you do want, as follows:

    dig +noall +answer soa yahoo.com | sed 's/.*SOA\s*//' | sed 's/^\([^ ]*\). .*/\1/g'

    This searches for a string beginning with some non-space characters, followed by a dot, a space, and then the rest of the line. It replaces that pattern with just the bit before the dot (which is subexpression #1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work for a company that uses Unix and Linux servers. Often times, scripts
I am doing short-term contract work for a company that is trying to implement
im new to the iPhone SDK and development. I work for a company that
At the company that I work with, we often have to integrate with client’s
The software company I work for offers data conversion as a service for new
I work in a company that has over 70 asp.net mvc projects (very similar
I'm doing some work in C++ for a company that has everything else written
I work for an IT services company that develops products as enablers for further
I work at a company that has many clients that have their own website
I’ve interned at a company that does a lot of mainframe work. Most of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.