I have a file in the following format and it is tab separated
a k testis adult male 8 week rRNA
b k testis adult male 8 week rRNA
c k testis adult male 8 week rRNA
I want to do some operation on each line so I am using a while loop.I want to split each line on tab and then store let's say 6th column which is 8 week in a variable. I am using this code but I am not able to get what I want
while read -r line; do tmp=(${line///}); col6=${tmp[5]}; echo "$col6"; done < file.txt
This gives me 8 and not 8 week. 8 week has a space in between 8 and week and hence I want to split the line on tab.
Any help would be appreciated.
Thanks