Bash – Two commands, one pipeline

bashdns

I need these two commands to be one (so I can pipe them further):

dig +nottlid -t any bix.hu | egrep -v "^;;|^;|^$" | sort
dig +nottlid -t any www.bix.hu | egrep -v "^;;|^;|^$" | sort

I mean I need the output of these two commands to be in one pipe:

$ dig +nottlid -t any bix.hu | egrep -v "^;;|^;|^$" | sort
bix.hu.         IN  A   193.239.149.1
bix.hu.         IN  MX  10 deneb.iszt.hu.
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
bix.hu.         IN  SOA ns.iszt.hu. hostmaster.iszt.hu. 2011053000 28800 7200 604800 14400

and

dig +nottlid -t any www.bix.hu | egrep -v "^;;|^;|^$" | sort
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
www.bix.hu.     IN  A   193.239.149.1

so that I could sha256sum them together, without writing the output of the two commands to one file, and sha256sum the file.

Q: it's like this:

echo hi | echo hi2 | sha256sum

of course this won't work, but are there any solutions for this? So that I need the sha256sum of:

hi
hi2
-->>
697ec886148d94d5b094df14f301f2e5a4abd8098a0e0dc2afb0a97945cea677

but I can only have the outputs from different commands [mentioned above, 2 different domains]. [Just want to write a "DNS checker" script to warn me when DNS records changes for a domain]

Best Answer

You can pass multiple names to dig:

dig +nottlid -t any bix.hu www.bix.hu | egrep -v "^;;|^;|^$" | sort
Related Question