I would like to run a command for each entry in a column of a file. I am currently doing the following, but am getting an ambiguous redirect error.
while read -r entry;
do
cmd "$entry" ;
done < $(cut -f2 file.tsv)
I've also tried
done <(cut -f2 file.tsv)
which throws an unexpected token syntax error.
What is the correct syntax for doing this?
Example Input
A tab separated values file with file paths in the column of interest.
1 file1.txt ...
2 file2.txt ...
3 file3.txt ...
Expected Result
The script should run the commands
cmd file1.txt
cmd file2.txt
cmd file3.txt
For the purpose of a simple example, you can use cat as the cmd, since the error is not with the cmd per se, but with the input redirection.
The actual command I am running is the bioinformatics tool kallisto, specifically kallisto quant.