I have a list of files in bam_files.txt which looks like this:


I want to do something like this:

cuffnorm -o cuffnorm_out /home/software/genes.gtf test/*.bam

but while reading files from bam_files.txt and not directly from directory (as shown above).

I want to read all the files together in the same command.

Can someone please help? Thanks a lot. Appreciate your help.

1 Answer 1


You could read bam_files.txt into an array, then use the array as arguments to cuffnorm:

mapfile -t bam_files < bam_files.txt
cuffnorm -o cuffnorm_out /home/software/genes.gtf "${bam_files[@]}"
  • @Goku looks like steeldriver deleted his answer?
    – wjandrea
    Mar 11, 2018 at 2:44
  • don't know why but here is his answer. this also works xargs -d '\n' cuffnorm -o cuffnorm_out /home/genes.gtf < bam_files.txt Thanks
    – Goku
    Mar 11, 2018 at 2:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .