I have done this way to read text file by using help from these : Split string into an array in Bash and How do I split a string on a delimiter in Bash? and trying to split string but i am getting only 1st line with this code: (i have pasted the same code in "file" which is i am reading.)
#!/bin/bash
i=0
for file in $(ls -l)
do
   if [ -f $file ] #checking for regular file
   then 
    if [ $file ==  Q1 ] || [ $file == Q1~ ] 
    then    
            continue
    else
        if [ -f $file ]
            then
               echo $file
               v=$(<$file)
          # echo ${v[0]} # prints all
#------------------ split string-----------------------
           OIFS="$IFS"
           IFS='' # split by spaces
            read -a array <<< "${v}"
        IFS="$OIFS"
           echo ${array[0]} #
           #printf "\n"
          # sed -i 's/$1/$2/g' "$file"
        else
        echo "Error: Not found"
        fi
    #i=$i+1
    #echo $i 
    fi
   fi
done
exit 0
but when using with loops, then there is no splitting (2nd code)
#!/bin/bash
i=0
for file in $(ls -l)
do
   if [ -f $file ] #checking for regular file
   then 
    if [ $file ==  Q1 ] || [ $file == Q1~ ] 
    then    
            continue
    else
        if [ -f $file ]
            then
               echo $file
               v=$(<$file)
          # echo ${v[0]} # prints all
#------------------ split string-----------------------
           OIFS="$IFS"
           while IFS=''  read -a array;
            do
           for i in "${array[@]}";do
               echo ${array[1]} #
           done
        done <<< "$v"
           #printf "\n"
          # sed -i 's/$1/$2/g' "$file"
        else
        echo "Error: Not found"
        fi
    #i=$i+1
    #echo $i 
    fi
   fi
done
exit 0
 
    