diff --git a/do_process b/do_process index 545e088..cc2a8d1 100755 --- a/do_process +++ b/do_process @@ -10,16 +10,19 @@ fi if [[ -f ${DATE}.log ]]; then get_list_of_orgs () { - orgs=$( grep -Po "\s+\[.*\]" | tr -d '[][]' ) - for org in ${orgs}; do - org="${org##*( )}" # trim leading whitespace - org="${org%%*( )}" # trim trailing whitespace + while read; do + org=$( grep -Po "\s+\[.*\]" <<< "${REPLY}" | tr -d '[][]' | xargs ) + [[ "${org}x" == "x" ]] && continue +# org="${org##*( )}" # trim leading whitespace +# org="${org%%*( )}" # trim trailing whitespace [[ "${ORGS[@]}" =~ "${org}" ]] || ORGS+=("${org}") done } get_list_of_orgs < ${DATE}.log + IFS=$'\n'; ORGS=($(sort -f <<< "${ORGS[*]}")); unset IFS + for (( i=0; i < ${#ORGS[@]}; i++ )); do echo "ORGS[$i]=${ORGS[$i]}" done