I have hundreds of files and I need to run a command on pairs of such files that only share the initial part of the filename. e.g.:
samtools merge Sample_1_L5.bam Sample_1_L6.bam
samtools merge Sample_2_L4.bam Sample_2_L5.bam
In essence the pairs share the Sample_x part of the filename and I'd like to make a for loop so as to run the command on all the files in pairs matched on the basis of that initial part of the filename.
Hope this is clear enough.
Thanks for your help! Joanito