tee twixt - | dig -f twixt

That should be 'tee twixt | dig -f -' (or only 'dig -f -' if you do not want to save "twixt"), for the same reason I explained you four times. If 'dig' does not understand "-" as "standard input", write 'tee twixt | dig -f /dev/stdin'.

... | grep -A1 "ANSWER SECTION:" - [copied & pasted from console into CPV-MB-Output02.txt, which follows below]
(...)
The fields, ";; ANSWER SECTION:" and "--" can be removed in Leafpad with the search-and-replace-all function
(...)
The varying-content fields between the two address fields can be deleted and replaced by tabs in LibreOffice Calc
(...)
Highlight the trailing dot and the following blank line in CPV-MB-Output03.txt, followed by pasting that combination of dot and two [end-of-line?] characters into Leafpad's search-and-replace-all function. All the blank lines and that pesky trailing dot will disappear ... except the final dot. That final dot can also be handled by adding [two carriage returns ?] (i.e., pressing "Enter" twice) at the end of the last row in the Leafpad file beforehand
(...)
Going back to Leafpad ... the "dot[tab]" fields can be removed by highlighting one of the ".\t" and then replacing all with "\t"

... or you write two lines of AWK that do all that and that you can re-execute whenever you want, to post-process dig's output:
#!/usr/bin/awk -f
BEGIN { RS = ";; ANSWER SECTION:" }
{
    print gensub(/\.$/, "", 1, $1) "\t" gensub(/\.$/, "", 1, $5)
}

Leafpad handles these steps quickly, if not in the blink of an eye.

Copy-pasting things between the terminal, a text editor and LibreOffice, highlighting things, typing, ... and doing all that all over again whenever you get new data to process. That is not quick. That is a waste of time.

It takes some time (maybe ~10h) to learn the text-processing commands (starting with the simplest use case; not with a real-world problem you face), but it is worth it. It takes time to search info pages, but it is worth it (for instance you could discover that 'grep' has an option --no-group-separator).

This is where I found out the "join" syntax used in my previous post: https://www.howtoforge.com/tutorial/linux-join-command/

That tutorial does not exemplify the use of the -o option, to format join's output.

Reply via email to