Allow spaces and sort organization names
This commit is contained in:
parent
5d17f2cbe1
commit
cc9909a0c7
11
do_process
11
do_process
|
@ -10,16 +10,19 @@ fi
|
||||||
|
|
||||||
if [[ -f ${DATE}.log ]]; then
|
if [[ -f ${DATE}.log ]]; then
|
||||||
get_list_of_orgs () {
|
get_list_of_orgs () {
|
||||||
orgs=$( grep -Po "\s+\[.*\]" | tr -d '[][]' )
|
while read; do
|
||||||
for org in ${orgs}; do
|
org=$( grep -Po "\s+\[.*\]" <<< "${REPLY}" | tr -d '[][]' | xargs )
|
||||||
org="${org##*( )}" # trim leading whitespace
|
[[ "${org}x" == "x" ]] && continue
|
||||||
org="${org%%*( )}" # trim trailing whitespace
|
# org="${org##*( )}" # trim leading whitespace
|
||||||
|
# org="${org%%*( )}" # trim trailing whitespace
|
||||||
[[ "${ORGS[@]}" =~ "${org}" ]] || ORGS+=("${org}")
|
[[ "${ORGS[@]}" =~ "${org}" ]] || ORGS+=("${org}")
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_list_of_orgs < ${DATE}.log
|
get_list_of_orgs < ${DATE}.log
|
||||||
|
|
||||||
|
IFS=$'\n'; ORGS=($(sort -f <<< "${ORGS[*]}")); unset IFS
|
||||||
|
|
||||||
for (( i=0; i < ${#ORGS[@]}; i++ )); do
|
for (( i=0; i < ${#ORGS[@]}; i++ )); do
|
||||||
echo "ORGS[$i]=${ORGS[$i]}"
|
echo "ORGS[$i]=${ORGS[$i]}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue