I tried to change an string to index to use for an array but I have been unable to get it to work.
This is my file
$ cat file1.txt
101,Harish,BAN
102,Srinu,HYD
And this code:
#!/bin/bash
IFS=','
while read line
do
DELIM_REMOVE=`echo $line|sed 's/,/ /g'`
V=($DEL_REMOVE)
echo ${DELIM_REMOVE}
for i in "${!V[@]}"; do
printf 'V[%s] = %s\n' "$i" "${V[i]}"
echo "${V[i]}"
done
done < /home/ec2-user/file1.txt
echo "${V[i]}"
I also need to use the dynamically generated variables in loop to another loop.