If you just want to refer to those fields by their names instead of numbers, you can use
while read id name age
echo "$id $age"
done < file.tsv
I saw your meaning at last! Here's a bash function that will print out only the columns you specify on the command line (by name).
while read $names; do
for col in $*
eval "printf '%s ' \$$col"
Here's how you can use it with the file you've presented:
$ < file.tsv printColumns id name
(The function reads
< file.tsv printColumns ... is equivalent of
printColumns ... < file.tsv and
cat file.tsv | printColumns ...)
$ < file.tsv printColumns name age
$ < file.tsv printColumns name age id name name name
ed 50 1 ed ed ed
joe 70 2 joe joe joe
Note: Pay attention to the names of the columns you request! This version lacks sanity checks, so nasty things can happen if one of the arguments is something like
"anything; rm /my/precious/file"