i have this file
Seq1
10 1 5
10 2 6
10 3 9
Seq2
15 2 7
15 4 9
15 8 12
i want to have arrays for each Seqs (Seq1, Seq2) like this:
2ndColumn=(1,2,3)
3rdColumn=(5,6,9)
i wrote this but it does not break the while loop..
#!/bin/bash
2ndColumn=()
3rdColumn=()
while read line
do
if [[ $line == S* ]]
echo "$line"
else
i=0
while [[ $line != S* ]]
do
2ndColumn[i]="$(echo $line | cut -d\ -f2)"
3rdColumn[i]="$(echo $line | cut -d\ -f3)"
i=$((i+1))
read line
done
echo "${2ndColumn[@]} and ${3rdColumn[@]}"
fi
done < file
exit 0
this script will iterate forever, it does not get out of while loop. please give a hand to this stupid humanbeing :(