I was actually just using `grep .` to discard empty lines. The `grep -v '^;'` would have only left lines with answers after it discarded lines starting with `;`. That and the empty lines.
I could have combined `grep -v '^;'` and `grep .` as a nice simple `grep '^[^;]'`
Re:Why is DNS still hard to learn?
by redundantly on Friday July 28, 2023 @04:24PM
(#36912792)
Ahh. I was working from memory, I forgot about the empty lines it returns. That's what I get for replying from my phone. :)
However, it's still better to just have the `dig` command return only the necessary information via the +short or +noall +answer flags, rather than parsing the full output.
Remind me again where this weird syntax came from for passing arguments?
- is allowed in domains
dash is only allowed in the middle. labels can't start or stop with it. so it wouldn't affect the command arguments.
The labels must follow the rules for ARPANET host names. They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen. There are also some
restrictions on the length. Labels must be 63 characters or less.
https://www.ietf.org/rfc/rfc1035.txtit's more likely that in the late 90s they just made up their own argument parsing that they liked and the application has just used that ever since.
If matching everything was intended then you don't need it at all:
Will strip out the lines beginning with a semi-colon.However, parsing the output of `dig` this way is not needed. It can be ran to only return the answer, for example:
Or if you just want the IP for that record: