Could someone help me if there exists some way how to get from dig only hostnames if I want to get list of DNS zone? I work with this command:
dig @dns.example.com example.com axfr
output is:
example1.com. 1200 IN A 1.1.1.1
example2.com. 1200 IN A 2.2.2.2
....
I would like to get only
example1.com
example2.com
....
I tried to use filters dig .... | cut -d ' ' -f1 , but it doesn't work correctly in this case. Maybe I should use some regex?
dig +short . . .or check out this question https://serverfault.com/questions/431080/dig-show-only-answer?rq=1 – Brandon Xavier Aug 31 '21 at 08:11+shortbut it gives me a lot of IP address instead of names. I think the better way will be to parse it. However I don't know how to cut first column. – jozinko9 Aug 31 '21 at 08:31