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
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue