|
Bash Populate array and ignore lines with certain characters
I'm trying to read a DNS file with a list of hosts into an array. I think I have the array populated, but I would like to ignore lines with certain chars, such as semicolon, at (@) sign, etc. I'm not sure how to do so. Can you point me in the right direction?
Right now, the below populates everything into an array. Thanks!
array=( $(ssh $USER@$DNS_SERVER "cat /var/cache/bind/dns_hosts | awk '{print \$1}'") )
echo ${array[@]}
|