I wrote this question before about bash script
" echo" in bash script empty file
I need script to extract information from whois to excel file (csv)
like:
A B C D E
domain ipaddress ownername owneraddress servertype
I wrote small script but ownername and domain address in same column
#!/bin/bash
while read domain; do
ipaddress=`dig $domain +short`
domcre=`whois $domain | grep "Created on" | cut -d ":" -f 2 | sed 's/ //' | sed -e :a -e '$!N;s/ \n/,/;ta'`
domexp=$(whois $domain | grep "Expiration Date" | cut -d ":" -f 2 | sed 's/ //' | sed -e :a -e '$!N;s/ \n/,/;ta')
ownname=$(whois $domain | grep -A 1 -i "Administrative Contact:" |cut -d ":" -f 2 | sed 's/ //' | sed -e :a -e '$!N;s/ \n/,/;ta')
echo -e "$domain,$ipaddress,$domcre,$domexp,\t$ownname" >> data.csv
done <d.txt