当我在命令下运行时,我得到的结果如下
dig +short ns kinoafisha.info | awk -v RS='' '{gsub("\n", ", "); print}' >> test.csv
dig +short ns linux.com | awk -v RS='' '{gsub("\n", ", "); print}' >> test.csv结果
ns2.kinoafisha.info., ns1.kinoafisha.info.
ns1.dnsimple.com., ns2.dnsimple.com., ns3.dnsimple.com., ns4.dnsimple.com.(我的问题)我正在尝试像(第一个域名,然后是DNS)
kinoafisha.info, ns2.kinoafisha.info., ns1.kinoafisha.info.
linux.com, ns1.dnsimple.com., ns2.dnsimple.com., ns3.dnsimple.com., ns4.dnsimple.com.PS:我将在一个循环(CSV)中运行所有域,然后运行命令如下
循环播放
while IFS= read -r line
do
dig +short ns $line | awk -v RS='' '{gsub("\n", ", "); print}' >> test.csv
done < domains.txt我需要为100个域运行多个命令,比如dig +short ns、dig +short a和dig +short mx等等.我想要横向打印结果。请建议一下。
我试着
dig +short ns $line | awk -v RS='' '{gsub("\n", ", "); print $line,$0}' >> test.csv但不起作用
发布于 2020-04-26 12:47:17
使用echo连接行值并输出dig命令:
echo "$line ," $(dig +short ns $line | awk -v RS='' '{gsub("\n", ", "); print $0}') >> test.csvhttps://stackoverflow.com/questions/61440812
复制相似问题