As I said the title. I tried this code:
areasArray=()
while IFS= read -r line
do
areaName="$(awk -F ";" '{print $3}')"
echo $areaName
if [[ ! " ${areasArray[@]} " =~ " $areaName " ]]; then
areasArray+=($areaName)
echo ${areasArray[*]}
fi
done < $reportFile
$reportFile refers to a CSV file that looks like this:
something;something;US
something;something;US
something;something;UK
something;something;FR
something;something;UK
something;something;FR
And the array will looks like this: US US UK FR UK FR. But I want every zone to be added only if it's not already there. So it should looks like this: US UK FR. How can I do that? Thanks.