I'm trying to store ip addresses given by host, but host actually gives a string saying host-name has address ip-address as many times as many addresses it finds. So my question is can I somehow access the addresses only, without splitting strings and looking for ip addresses? What I've tried so far looks like this
ip=$(host "$candidate")
IFS="s " read -ra ADDR <<< "$ip"
for i in "${ADDR[@]}"; do
echo "$i"
done
where $candidate holds the host name, but I couldn't really put it to work. Any ideas?