I want to add the elements of the fourth column in each line of the file to an array, but now I don't know how to add the separated elements to another array. My approach seems to have some problems:
#!/bin/bash
declare -a arr
cat 2.csv | while read line
do
IFS=',' read -ra str <<< "$line"
# echo ${str[3]}
arr+=(${str[3]})
done
for(( i=0;i<${#arr[@]};i++)) do
echo ${arr[i]};
done;