Im new to bash scripting... Im trying to sort and store unique values from an array into another array. eg:
list=('a','b','b','b','c','c');
I need,
unique_sorted_list=('b','c','a')
I tried a couple of things, didnt help me ..
sorted_ids=($(for v in "${ids[@]}"; do echo "$v";done| sort| uniq| xargs))
or
sorted_ids=$(echo "${ids[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')
Can you guys please help me in this ....
| xargsout of your first try.