I\'ve got almost the same question as here.
I have an array which contains aa ab aa ac aa ad, etc. Now I want to select all unique elements from this ar
aa ab aa ac aa ad
this one will also preserve order:
echo ${ARRAY[@]} | tr [:space:] '\n' | awk '!a[$0]++'
and to modify the original array with the unique values:
ARRAY=($(echo ${ARRAY[@]} | tr [:space:] '\n' | awk '!a[$0]++'))