read file into array If your file always has a '#' respectively numbers on the beginng of the line I would start like this. #!/bin/sh host=`awk '/^[^#]/ {print $1}' file` or ...
www.linuxmisc.com