Store values from a file into an array variable in Shell

Dear All,

I have been trying to do a simple task of extracting 2 fields from the file (3 rows) and store it in an array variable. I tried with:

#! /bin/bash
ch=`cut -f10 tmp.txt`
counter=0

for p in $pid
do
        c=${ch[$counter]}
        echo "$c ..$counter"
        counter=$((counter+1))
done

The filed 10 has 3 values: 14,19,6 in tmp.txt file. When I execute, I am getting:

14
19
6 ..0
 ..1
 ..2

but I would like to have:

14 ..0
19 ..1
6 ..2

Could you please help me to fix this?

Thanks in advance,
Ezhil

# cat justdoit
#!/bin/bash
ch=($(cut -d" " -f10 tmp.txt|tr -s "," " "))
counter=0
for((i=0;i<=${#ch};i++)); do
c=${ch[$counter]}
echo "$c ..$counter"
((counter++))
done
# ./justdoit
14 ..0
19 ..1
6 ..2

Hi,

Thanks a lot.

Cheers,
Ezhil