#!/bin/bash get_host_declerations () { local SECTION_CONTENT SECTION_NAME local -n HASH_TABLE="${1:?"get_subnet_declerations: Hash table was not provided"}" local CONTENT="${2:?"get_subnet_declerations: Content to be parsed was not provided"}" local -a SECTIONS get_sections $HOST_BEGIN_REGEX SECTIONS "$CONTENT" for i in ${!SECTIONS[@]}; do SECTION_CONTENT="${SECTIONS[$i]}" SECTION_NAME=`grep "host" <<< "$SECTION_CONTENT" | awk '{ print $2 }'` HASH_TABLE["$SECTION_NAME"]="${SECTION_CONTENT}" done }